Skip to content

Game.Prefabs.NetCompositionMeshRef

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType

Summary:
A lightweight ECS component that stores a reference to a mesh Entity used for net (road/track) composition and a flag indicating whether that mesh should be rotated when placed. Implements IComponentData so it can be attached to Entities, and IQueryTypeParameter to allow use in query parameter contexts.


Fields

  • public Unity.Entities.Entity m_Mesh
    Holds an Entity reference to the mesh used for net composition (typically a render mesh, prefab mesh entity, or an entity that represents the mesh to instantiate/use for a net segment).

  • public System.Boolean m_Rotate
    When true, indicates the mesh should be rotated to align with the net segment orientation (useful for directional pieces). When false, the mesh is used with its default rotation.

Properties

  • None. This type exposes public fields only; there are no properties.

Constructors

  • Implicit default constructor (public NetCompositionMeshRef() generated by the runtime)
    Initializes fields to their default values: m_Mesh = Entity.Null, m_Rotate = false. No explicit constructors are defined in the source.

Methods

  • None. This struct contains no methods; it is a plain data container (POD) intended for use as a component in ECS systems.

Usage Example

// Assigning the component to an entity (EntityManager API)
var meshRef = new NetCompositionMeshRef
{
    m_Mesh = meshEntity, // previously obtained Entity that represents the mesh
    m_Rotate = true
};
entityManager.AddComponentData(targetEntity, meshRef);

// Reading/updating in a system (SystemBase style)
Entities
    .ForEach((ref NetCompositionMeshRef meshRef) =>
    {
        // Use meshRef.m_Mesh and meshRef.m_Rotate to control rendering or placement logic
        if (meshRef.m_Mesh != Entity.Null && meshRef.m_Rotate)
        {
            // apply rotation logic...
        }
    })
    .Schedule();