Skip to content

Game.Routes.RouteSegment

Assembly:
Game (Assembly-CSharp / mod assembly)

Namespace:
Game.Routes

Type:
struct

Base:
Implements: Unity.Entities.IBufferElementData, Colossal.Serialization.Entities.IEmptySerializable

Summary:
Represents a single route segment reference stored in an ECS dynamic buffer. The type is a simple, blittable buffer element that holds an Entity reference to a segment. It is annotated with [InternalBufferCapacity(0)], meaning the buffer has zero inline capacity (all elements are stored externally). Implementing IEmptySerializable makes it compatible with the Colossal Order serialization plumbing used by the game/mod ecosystem.


Fields

  • public Unity.Entities.Entity m_Segment
    Holds the Entity that represents the route segment. Use this field to read or write the referenced segment entity when iterating or manipulating a DynamicBuffer.

Properties

  • (none)
    This struct exposes no properties; it only contains the public field m_Segment.

Constructors

  • public RouteSegment(Unity.Entities.Entity segment)
    Initializes a new RouteSegment with the provided Entity reference and stores it in m_Segment.

Methods

  • (none)
    This struct defines no methods; it is a plain data container used as a buffer element.

Usage Example

// Obtain an EntityManager (example using default world)
var entityManager = Unity.Entities.World.DefaultGameObjectInjectionWorld.EntityManager;

// Create or obtain the route entity that will own the buffer
var routeEntity = entityManager.CreateEntity();

// Add a DynamicBuffer<RouteSegment> to the route entity
var buffer = entityManager.AddBuffer<Game.Routes.RouteSegment>(routeEntity);

// Add a segment Entity reference to the buffer
Entity segmentEntity = /* obtain/create your segment entity */;
buffer.Add(new Game.Routes.RouteSegment(segmentEntity));

// Read back the first segment
var first = buffer[0].m_Segment;

{{ Notes: - Because of [InternalBufferCapacity(0)], the buffer will not reserve inline elements on the entity; storage is allocated externally. - The struct is safe to use in jobs and ECS systems as a buffer element (IBufferElementData). - IEmptySerializable is part of Colossal Order's serialization helpers; it signals compatibility with the game's custom serialization expectations. }}