Game.Net.LabelMaterial
Assembly:
Namespace: Game.Net
Type: struct
Base: ISharedComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
LabelMaterial is a lightweight shared component used by the ECS to tag entities with a material/index identifier for label rendering or material selection on net-related entities. It carries a single integer index (m_Index) that modders or systems can use to reference a particular label/material variant consistently across entities. Being a shared component, entities that share the same m_Index value will be grouped together by the EntityManager for chunking and rendering optimizations.
Fields
public System.Int32 m_Index
This integer stores the material or label index associated with the entity. The meaning of the index is project-specific (for example: different label textures, material presets, or rendering variants). Because this is the only data in the struct, comparisons and grouping are based solely on this value.
Properties
- This type exposes no properties. It is a plain struct field container used as a shared component.
Constructors
public LabelMaterial()
The implicit parameterless constructor is provided by C#. You can construct an instance and set m_Index directly, e.g.new LabelMaterial { m_Index = 3 }
.
Methods
- This struct declares no methods. It implements marker/serialization interfaces:
- ISharedComponentData: marks the struct as a shared component for Unity.Entities.
- IQueryTypeParameter: indicates the type can be used as a query type parameter in ECS queries.
- IEmptySerializable: indicates the type supports the serialization expectations used by the game's Colossal.Serialization pipeline (no custom methods are required here).
Usage Example
// Create and assign as a shared component to an entity
var labelMat = new Game.Net.LabelMaterial { m_Index = 5 };
entityManager.AddSharedComponentData(someEntity, labelMat);
// Querying or filtering by shared component value (pseudo-code)
var query = entityManager.CreateEntityQuery(
ComponentType.ReadOnly<SomeRenderComponent>(),
ComponentType.ReadOnly<Game.Net.LabelMaterial>()
);
// You can change the index for an entity to move it between shared-component groups:
entityManager.SetSharedComponentData(someEntity, new Game.Net.LabelMaterial { m_Index = 2 });