Game.Rendering.RouteBufferIndex
Assembly: Game
Namespace: Game.Rendering
Type: struct
Base: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
A very small ECS component that stores an integer index into a route (or path) buffer. This component is used by rendering/route systems to associate an entity with a slot in a separate route buffer structure. It is a plain value container (one int) and is suitable for fast copy, serialization by the Colossal (Cities: Skylines 2) serializer, and use in queries/jobs due to the implemented interfaces.
Fields
public int m_Index
Holds the index into the route/path buffer that this entity refers to. Typical values are non-negative indices referencing an array or buffer managed by other systems. This is a plain integer field (not a property) and is intended to be read and written by systems that manage or consume route data.
Properties
- None. This struct exposes a public field rather than properties.
Constructors
- Implicit default constructor (
new RouteBufferIndex()
)
Initializes m_Index to 0. You can also initialize explicitly using object initializer syntax (see usage).
Methods
- None. This is a simple data container type without behavior.
Usage Example
// Add the component to an entity with an index of 5
var routeComp = new RouteBufferIndex { m_Index = 5 };
entityManager.AddComponentData(entity, routeComp);
// Read the index from an entity
if (entityManager.HasComponent<RouteBufferIndex>(entity))
{
var comp = entityManager.GetComponentData<RouteBufferIndex>(entity);
int index = comp.m_Index;
// Use index to look up route data in the route buffer
}
Notes: - Because this struct implements IComponentData it can be stored in entity archetypes and used in ECS queries. - IQueryTypeParameter and IEmptySerializable markers make it suitable for use in query contexts and for the Colossal serialization pipeline used by the game.