Extensions
Each extension has been crafted to address common game development scenarios. They encapsulate and abstract away some of the complexities involved in setting up these scenarios, thus allowing you to focus more on the game logic and less on the setup and configuration.
To modify an extension, you can examine its code to understand how it works. Once you grasp the underlying logic, you can modify it or even create a new extension that better suits your needs. Remember, these extensions are just tools to help you get started; don't be afraid to modify them or build your own to align with your unique requirements.
In conclusion, whether you are a beginner just starting out with Stride or an experienced developer looking for a quicker way to get your game up and running, these extensions are a valuable resource. They are designed to be a starting point that can be used as is, or can be customised and built upon to create the perfect solution for your game development needs.
Remember, the key to mastering Stride, and game development in general, is practice and exploration. So, go ahead, play around with these extensions, and start creating!
GameExtensions.cs
Some extensions return Entity
so it can be further modified.
Run()
- Initialising the game, usestart
andupdate
paramsSetupBase()
- Adds graphics compositor, camera and directional lightSetupBase2DScene()
- Same asSetupBase()
plus skybox, ground, mouse look cameraSetupBase3DScene()
- Same asSetupBase()
plus skybox, ground, mouse look cameraAddGraphicsCompositor()
- Adds a defaultGraphicsCompositor
Add2DCamera()
- Adds 2D cameraAdd3DCamera()
- Adds 3D cameraAddDirectionalLight()
- Adds directional lightAddSkybox()
- Adds skyboxAdd2DGround()
- Adds 2D groundAdd3DGround()
- Adds 3D groundAddInfinite3DGround()
- Adds infinite 3D ground
GraphicsCompositorExtensions.cs
AddCleanUIStage()
- Adds a UI render stage and white/clean text effect to the givenGraphicsCompositor
AddGizmo()
- Adds Gizmo to the ground
ScriptComponentExtensions.cs
| DeltaTime()
|| Easier way of getting DeltaTime as a float
in seconds |
| GetCamera()
|| Gets the first camera with the name "Main", currently doesnt work at the start of a game due to being null in the GraphicsCompositor
|
| GetCamera(string name)
|| Gets the first camera with the name provided, currently doesnt work at the start of a game due to being null in the GraphicsCompositor
|
| GetFirstCamera()
|| Gets the first camera in the GraphicsCompositor
. currently doesnt work at the start of a game due to being null in the GraphicsCompositor
|
AnimationComponentExtensions.cs
| PlayAnimation()
|| Plays an animation if not already playing |
ModelComponentExtensions.cs
| GetMeshHeight()
|| Gets the Mesh height as a float
|
| GetMeshHWL()
|| Gets the Mesh height, width and length as a Vector3
|