Extensions
Each extension addresses common game development scenarios. They encapsulate setup details so you can focus on game logic.
Feel free to inspect and modify the source to adapt behavior or create your own variants. These are starting points, use them as-is or customize as needed.
Practice and exploration help you master Stride. Tinker with the extensions and start building!
GameExtensions.cs
Some extensions return Entity
so it can be further modified.
Run()
- Initializing the game; usestart
andupdate
parameters.SetupBase2D()
- Adds a graphics compositor and a camera.SetupBase3D()
- Adds a graphics compositor, camera, and directional light.SetupBase2DScene()
- LikeSetupBase()
plus skybox, ground, mouse-look camera.SetupBase3DScene()
- LikeSetupBase()
plus skybox, ground, mouse-look camera.AddGraphicsCompositor()
- Adds a defaultGraphicsCompositor
.Add2DCamera()
- Adds a 2D camera.Add3DCamera()
- Adds a 3D camera.AddDirectionalLight()
- Adds a directional light.AddSkybox()
- Adds a skybox.Add2DGround()
- Adds 2D ground.Add3DGround()
- Adds 3D ground.AddInfinite3DGround()
- Adds infinite 3D ground.
GraphicsCompositorExtensions.cs
AddCleanUIStage()
- Adds a UI render stage and a clean white text effect to theGraphicsCompositor
.
AddGizmo()
- Adds a gizmo to the ground.
ScriptComponentExtensions.cs
DeltaTime() |
Returns delta time as float seconds |
|
---|---|---|
GetCamera(string name) |
Gets the first camera by name; currently doesn't work at game start due to null in GraphicsCompositor |
|
GetFirstCamera() |
Gets the first camera in GraphicsCompositor ; currently doesn't work at game start due to null |
AnimationComponentExtensions.cs
| PlayAnimation()
| | Plays an animation if not already playing |
ModelComponentExtensions.cs
GetMeshHeight() |
Returns mesh height as float |
---|