Skip to content

Game.Prefabs.NetCompositionMeshData

Assembly: Assembly-CSharp (game assembly where most gameplay types live)
Namespace: Game.Prefabs

Type: struct (value type)

Base: Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
Represents mesh composition data for a "net" prefab (road/track/utility segment) used by the game's ECS-based systems. This component stores per-mesh layout and rendering-related parameters such as layer masks, state flags, height bounds, widths and LOD/shadow biases. It's intended to be attached to entities that represent net prefab compositions so rendering, collision and composition logic can read these values.


Fields

  • public MeshLayer m_DefaultLayers
    Default mesh layers used by this composition. Typically a bitmask indicating which render/update layers the mesh should belong to by default.

  • public MeshLayer m_AvailableLayers
    Layers that this mesh can appear on; used to determine which variants/layers are available for this composition.

  • public MeshFlags m_State
    Per-mesh state flags. Encodes runtime/compile-time flags that affect mesh handling (visibility, dynamic/static hints, etc.).

  • public CompositionFlags m_Flags
    High-level composition flags describing additional behaviors or properties of this composition (for example special composition rules or modifiers).

  • public Bounds1 m_HeightRange
    Height range (likely a 1D bounds type from Colossal.Mathematics) describing the vertical extents the mesh covers or is valid for. Used for culling, placement and composition decisions.

  • public float m_Width
    Width of the composition (in world units). Often used for placement and collision calculations.

  • public float m_MiddleOffset
    Offset of the composition's "middle" relative to some baseline (used when centering or offsetting mesh along its cross-section).

  • public float m_IndexFactor
    Factor applied to index calculations (may influence how different LODs or sub-mesh indices are calculated/selected).

  • public float m_LodBias
    Level-of-detail bias. Positive/negative values shift LOD selection to favor higher or lower detail.

  • public float m_ShadowBias
    Bias used when rendering shadows for this mesh (helps reduce shadow acne or adjust shadow LOD/quality).

  • public int m_Hash
    Integer hash used to identify this composition (for caching, lookups or quick equality checks).

Properties

  • None declared on this type. This struct exposes plain public fields for data access.

Constructors

  • public NetCompositionMeshData() (implicit default)
    No explicit constructors are defined in the source. The struct uses the default parameterless constructor provided by C#. Initialize fields individually when creating instances.

Methods

  • None declared on this type. The struct is a pure data container (IComponentData) and contains no behavior.

Usage Example

// Example: creating and adding the component to an entity using the EntityManager
using Unity.Entities;
using Game.Prefabs;
using Colossal.Mathematics;

var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity();

// Fill values as appropriate for your composition
var meshData = new NetCompositionMeshData
{
    m_DefaultLayers = /* set MeshLayer mask */,
    m_AvailableLayers = /* set MeshLayer mask */,
    m_State = /* MeshFlags value */,
    m_Flags = /* CompositionFlags value */,
    m_HeightRange = new Bounds1(min: 0f, max: 5f),
    m_Width = 4.0f,
    m_MiddleOffset = 0.0f,
    m_IndexFactor = 1.0f,
    m_LodBias = 0.0f,
    m_ShadowBias = 0.01f,
    m_Hash = 12345678
};

entityManager.AddComponentData(entity, meshData);

// Later, read/update:
var readMeshData = entityManager.GetComponentData<NetCompositionMeshData>(entity);
readMeshData.m_Width = 5.0f;
entityManager.SetComponentData(entity, readMeshData);

Notes: - Because this type implements IComponentData, it's intended for use with Unity's ECS (DOTS) workflows. - The exact semantics of MeshLayer, MeshFlags, CompositionFlags and Bounds1 come from the game's codebase (Colossal-specific types); consult their definitions for precise flag values and behaviors.