Skip to content

Game.Prefabs.NetCompositionData

Assembly:
(unknown / likely Assembly-CSharp or Game)

Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
NetCompositionData is a plain ECS component (value type) that holds per-composition metrics and configuration used by the game's road/net composition system. It aggregates geometry offsets, height ranges, connection offsets, flags/state and LOD data that the net rendering / construction systems use to position and choose sub‑pieces of a net/prefab (for example road segments, sidewalks, roundabouts, connections). Fields use Unity.Mathematics types (float2/float4) and custom types from Colossal and the game (Bounds1, CompositionFlags, CompositionState). Many fields represent distances/heights in world units (Unity units ≈ meters) and bitflags controlling composition behaviour.


Fields

  • public float4 m_SyncVertexOffsetsLeft
    Holds four vertex offset values used to align/synchronize the left-side vertices of the composition when stitching or interpolating adjacent pieces. Typically used to avoid seams when two pieces meet and to shift vertex positions along the left edge.

  • public float4 m_SyncVertexOffsetsRight
    Same as m_SyncVertexOffsetsLeft but for the right side of the composition.

  • public Bounds1 m_HeightRange
    A Bounds1 struct representing the min/max vertical range the composition occupies. Used to quickly test whether the composition intersects a given height band (useful for culling or placement decisions).

  • public Bounds1 m_SurfaceHeight
    A Bounds1 describing the surface height band for the composition (e.g., the visual surface elevation). This may differ from the full height range (which could include substructure).

  • public float4 m_EdgeHeights
    Four edge height values (typically corners or indexed edge points) that specify vertical offsets at the composition's edges. Used to produce varied edge profiles or slope transitions.

  • public float2 m_RoundaboutSize
    Two-component vector storing roundabout sizing parameters. Commonly contains inner/outer radius or width/offset values used when the composition describes roundabout geometry.

  • public float2 m_SideConnectionOffset
    Offset values for side connections (left/right or inner/outer) to position side attachment points (e.g., for side roads, tram tracks or decorative edges).

  • public CompositionFlags m_Flags
    Bitflags describing composition options (mirroring, symmetry, whether to use certain meshes, special behaviors for intersections or decorations). CompositionFlags is an enum/flag type defined elsewhere in the codebase.

  • public CompositionState m_State
    Runtime or configuration state of the composition (for example enabled/disabled, baked vs dynamic, or other state categories). CompositionState is an enum defined elsewhere.

  • public float m_Width
    Overall width of the composition (world units). Used to compute spacing, lane placement and visuals.

  • public float m_MiddleOffset
    Offset applied relative to the center/midline of the composition. Adjusts where the middle axis lies for alignment.

  • public float m_WidthOffset
    Additional horizontal offset applied to the width (shifts the whole width region left or right).

  • public float m_NodeOffset
    Offset applied at node/junction points. Useful to tweak how pieces meet at nodes to avoid overlaps or gaps.

  • public int m_MinLod
    Minimum level-of-detail (LOD) index at which this composition should be considered/rendered. Lower LOD indices are typically higher detail; this value is used for culling or selection of simpler compositions at distance.

Properties

  • None. This struct is a plain data container with public fields (no C# properties).

Constructors

  • public NetCompositionData()
    Implicit default constructor (value-type). All fields are default-initialized. Initialize fields explicitly when creating an instance to ensure meaningful behavior (e.g., set widths, offsets, flags and heights relevant to your composition).

Methods

  • None. NetCompositionData is a POD (plain old data) component used by systems that read/write it.

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Colossal.Mathematics;
using Game.Prefabs;

// Create and populate the component data, then add it to an entity
var comp = new NetCompositionData
{
    m_SyncVertexOffsetsLeft  = new float4(0f, 0.1f, 0.2f, 0.3f),
    m_SyncVertexOffsetsRight = new float4(0f, 0.1f, 0.2f, 0.3f),
    m_HeightRange = new Bounds1 { min = -0.5f, max = 1.5f },
    m_SurfaceHeight = new Bounds1 { min = 0f, max = 1f },
    m_EdgeHeights = new float4(0f, 0f, 0f, 0f),
    m_RoundaboutSize = new float2(5f, 8f),
    m_SideConnectionOffset = new float2(0.2f, -0.2f),
    m_Flags = CompositionFlags.None, // set the appropriate flags enum
    m_State = CompositionState.Active, // example value
    m_Width = 6f,
    m_MiddleOffset = 0f,
    m_WidthOffset = 0f,
    m_NodeOffset = 0.1f,
    m_MinLod = 2
};

// Using EntityManager to add the component to an entity:
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, comp);

Notes and tips: - Units are engine/world units (approx. meters). Verify with the rest of the mod/game codebase if you need precise conversions. - CompositionFlags and CompositionState are defined elsewhere; inspect them to understand which flags should be set for mirrored pieces, hollow/solid, connection rules, etc. - Because this is an ECS component (IComponentData), prefer bulk operations or System updates for modifying instances to keep performance predictable.