Class GameExtensions
Provides extension methods for the Game class to enhance functionality such as adding skyboxes and other game elements.
public static class GameExtensions
- Inheritance
-
GameExtensions
Remarks
These methods allow for easy integration of common game elements into a Stride game project, reducing the need for manual setup.
Methods
AddSkybox(IGame, string?)
Adds a skybox to the specified game scene, providing a background texture to create a more immersive environment.
public static Entity AddSkybox(this IGame game, string? entityName = "Skybox")
Parameters
gameIGameThe Game instance to which the skybox will be added.
entityNamestringThe name of the skybox entity. Defaults to "Skybox".
Returns
Examples
This example demonstrates how to add a skybox to a game:
game.AddSkybox();
Remarks
The skybox texture is loaded from the Resources folder and is used to generate a skybox using the SkyboxGenerator. The skybox entity is created with both a BackgroundComponent and a LightComponent, configured for the skybox. The entity is added to the root scene of the game and placed at the default position (0.0f, 2.0f, -2.0f).