EntityExtensions.cs is a collection of extension methods enhancing the functionality of entities within the Stride game engine. These methods provide additional capabilities to entities, making it easier to work with them in various scenarios. From adding gizmos and interactive scripts to retrieving components and managing entity positions, these extensions offer a variety of useful tools for developers.
Here is an overview of the available extension methods:
Add2DCameraController()- Adds an interactive 2D camera script to the specified entity, enabling camera movement and rotation
Add3DCameraController()- Adds an interactive 3D camera script to the specified entity, enabling camera movement and rotation
AddGizmo()- Adds a TranslationGizmo to the specified entity with optional custom colors
GetComponent<T>()- Retrieves the first component of the specified type from the entity
GetComponents<T>()- Retrieves all components of the specified type from the entity
Remove()- Removes the entity from its current scene by setting its
Sceneproperty to null
TryGetComponent<T>()- Tries to retrieve a component of type T from the given entity
WorldPosition()- An easier way to get world position
These extensions are designed to streamline common tasks associated with entities in Stride, enhancing the overall efficiency and flexibility of game development workflows.