Game.Routes.RouteWaypoint
Assembly:
Assembly-CSharp (typical game assembly — may be included in the game's main assembly or a mod assembly)
Namespace:
Game.Routes
Type:
struct
Base:
Implements Unity.Entities.IBufferElementData, Colossal.Serialization.Entities.IEmptySerializable
Summary:
RouteWaypoint is a small ECS buffer element used to store a reference to a waypoint Entity in the route system. It's intended to be stored inside a DynamicBuffer
Fields
public Unity.Entities.Entity m_Waypoint
Holds the Entity reference for a single waypoint. Use this field to read or write the stored waypoint Entity when iterating or manipulating the DynamicBuffer.
Properties
- This type does not declare any properties. Access the waypoint through the public field m_Waypoint or via the DynamicBuffer wrapper.
Constructors
public RouteWaypoint(Unity.Entities.Entity waypoint)
Initializes a new RouteWaypoint with the provided Entity reference (assigns m_Waypoint = waypoint). Useful when adding elements to a DynamicBuffer.
Methods
- This type does not declare any methods. It is a simple POD buffer element.
Usage Example
// Example inside a ComponentSystem/ISystem or other ECS context:
Entity routeEntity = /* the entity that holds the route buffer */;
Entity waypointEntity = /* an entity representing a waypoint */;
// Get the dynamic buffer on the route entity and add a waypoint entry
var buffer = EntityManager.GetBuffer<RouteWaypoint>(routeEntity);
buffer.Add(new RouteWaypoint(waypointEntity));
// Iterate buffer
foreach (var entry in buffer)
{
Entity wp = entry.m_Waypoint;
// handle waypoint entity
}
Additional notes:
- The [InternalBufferCapacity(0)] attribute means the DynamicBuffer has zero inline capacity in the chunk; elements will be stored externally when present. Choose this intentionally to avoid chunk bloat if many waypoints are expected.
- Being an IBufferElementData makes this type compatible with Unity's DynamicBuffer API and jobified systems that operate on DynamicBuffer