Game.Prefabs.NetCompositionCarriageway
Assembly: Assembly-CSharp (game code / mod assembly; actual assembly name may vary)
Namespace: Game.Prefabs
Type: struct
Base: Unity.Entities.IBufferElementData
Summary:
A small ECS buffer element that describes a single carriageway sample/entry used by net (road) composition data. Instances store the local/world position of the carriageway sample, its width, and lane-related flags. The struct is annotated with [InternalBufferCapacity(0)], indicating the dynamic buffer has no inline storage capacity and will always allocate storage on the heap when used.
Fields
-
public float3 m_Position
Represents the position of this carriageway sample. Uses Unity.Mathematics.float3. This is typically a point along the net/road where the width and lane flags apply. Coordinate space (local vs world) depends on how the containing system/entity uses the buffer. -
public float m_Width
The width (in game units, usually meters) of the carriageway at this sample. -
public LaneFlags m_Flags
Bitflag value describing lane/carriageway properties at this sample. LaneFlags is an enum (defined elsewhere in the codebase) that encodes lane types, directions, and other lane-specific attributes. Consult the LaneFlags definition to interpret values.
Properties
This type has no C# properties; it is a plain buffer element (public fields only).
Constructors
public NetCompositionCarriageway()
No explicit constructor is defined in the source. As a value type, it has the implicit default constructor that zero-initializes fields (m_Position = float3.zero, m_Width = 0f, m_Flags = default).
Methods
There are no instance or static methods defined on this struct. It is intended to be a simple data carrier used inside a DynamicBuffer
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;
// Example: adding/setting carriageway samples on an entity
public void AddCarriagewaySamples(EntityManager entityManager, Entity entity)
{
// Ensure the entity has the dynamic buffer
var buffer = entityManager.GetBuffer<NetCompositionCarriageway>(entity);
// Add a sample
buffer.Add(new NetCompositionCarriageway {
m_Position = new float3(0f, 0f, 0f),
m_Width = 3.5f,
m_Flags = LaneFlags.None // replace with appropriate flag(s)
});
// Add another sample
buffer.Add(new NetCompositionCarriageway {
m_Position = new float3(10f, 0f, 0f),
m_Width = 3.5f,
m_Flags = LaneFlags.Driving | LaneFlags.Forward // example flags
});
}
Notes: - Because of [InternalBufferCapacity(0)], the dynamic buffer will not reserve inline storage on the Entity and will always use heap allocation for its contents. - Interpret m_Position coordinate space according to the surrounding systems (authoring vs runtime transforms). - Check the definition of LaneFlags in your project to know which combinations are valid and their meanings.