Skip to content

Game.Areas.LabelVertex

Assembly: Assembly-CSharp
Namespace: Game.Areas

Type: struct

Base: Unity.Entities.IBufferElementData, Colossal.Serialization.Entities.IEmptySerializable

Summary: LabelVertex is a buffer element type used by the ECS (Entity Component System) to represent a single vertex for area/label rendering. It contains the vertex position, two UV sets, vertex color and a material index. The type is marked with [InternalBufferCapacity(0)], meaning instances are stored in an external dynamic buffer rather than inline in the entity archetype. Implementing IEmptySerializable indicates support for Colossal's serialization conventions used by the game/mod framework.


Fields

  • public Unity.Mathematics.float3 m_Position Represents the vertex position in local/object space (x, y, z). Typically used by the renderer to place the vertex.

  • public Unity.Mathematics.float2 m_UV0 Primary texture coordinates for the vertex (u, v). Used for sampling the main texture.

  • public Unity.Mathematics.float2 m_UV1 Secondary texture coordinates (u, v). Often used for lightmaps, detail maps, or additional texture lookups.

  • public UnityEngine.Color32 m_Color Vertex color stored as Color32 (RGBA). Can be used for tinting or per-vertex color effects.

  • public System.Int32 m_Material Integer index identifying the material to use when rendering this vertex/primitive. The meaning depends on the rendering pipeline / material manager used by the mod.

Additional note: The struct is annotated with [InternalBufferCapacity(0)], so the default internal capacity is zero — buffer elements will be allocated in a dynamic buffer rather than stored inline.

Properties

  • None. This is a plain buffer element containing public fields.

Constructors

  • Implicit default constructor (parameterless) Structs in C# always have an implicit parameterless constructor that zero-initializes fields. No explicit constructors are defined in the source.

If you need convenience construction, you can create helper constructors or factory methods in your code (example shown below).

Methods

  • None declared on this type. (It simply serves as a POD buffer element. Serialization support is provided via the IEmptySerializable marker for Colossal's serializer.)

Usage Example

// Example: creating/populating a dynamic buffer of LabelVertex in a System or ComponentSystemBase
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
using Game.Areas;

public partial class LabelBufferExampleSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities.ForEach((Entity entity, int entityInQueryIndex, ref DynamicBuffer<LabelVertex> labels) =>
        {
            // Clear existing vertices
            labels.Clear();

            // Add a single label quad (2 triangles = 4 vertices) as an example
            var v0 = new LabelVertex
            {
                m_Position = new float3(-0.5f, 0f, -0.5f),
                m_UV0 = new float2(0f, 0f),
                m_UV1 = new float2(0f, 0f),
                m_Color = new Color32(255, 255, 255, 255),
                m_Material = 0
            };

            var v1 = v0; v1.m_Position = new float3(0.5f, 0f, -0.5f); v1.m_UV0 = new float2(1f, 0f);
            var v2 = v0; v2.m_Position = new float3(0.5f, 0f, 0.5f);  v2.m_UV0 = new float2(1f, 1f);
            var v3 = v0; v3.m_Position = new float3(-0.5f, 0f, 0.5f); v3.m_UV0 = new float2(0f, 1f);

            labels.Add(v0);
            labels.Add(v1);
            labels.Add(v2);
            labels.Add(v3);

            // Note: actual index/triangle setup is typically handled by the renderer or an index buffer
        }).ScheduleParallel();
    }
}

{{ This struct is intended as a lightweight POD (plain-old-data) element for ECS rendering buffers. When creating and consuming DynamicBuffer, consider alignment and conversion to native mesh/index buffers before issuing draw calls. The m_Material index should map to your mod's material table or renderer indices. }}