Skip to content

Game.SubMeshGroup

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
A small IBufferElementData struct used to describe a logical group of submeshes on a prefab/mesh. It packs a subgroup count, a two-integer range (start/length) for submesh indices, and a set of flags (MeshGroupFlags) describing group behavior. The struct is annotated with [InternalBufferCapacity(0)], so instances are stored in a dynamic buffer (no in-chunk inline capacity).


Fields

  • public int m_SubGroupCount
    Number of subgroups contained in this SubMeshGroup. Typically used to know how many logical subgroups are represented by this buffer element.

  • public int2 m_SubMeshRange
    Two-component integer describing the range of submesh indices covered by this group. Common interpretation is (startIndex, count) where .x is the start index and .y is the number of submeshes in the range. The type comes from Unity.Mathematics.

  • public MeshGroupFlags m_Flags
    Bitflags (enum) describing properties of the mesh group (defined elsewhere as MeshGroupFlags). Flags may encode rendering/behavioral hints such as shadow casting, dynamic/static usage, or other group-specific options.

Properties

  • This type defines no properties. It is a plain public-field struct intended for use as a buffer element (DynamicBuffer).

Constructors

  • public SubMeshGroup()
    Struct default constructor (compiler-provided). All fields default to zero/null: m_SubGroupCount == 0, m_SubMeshRange == int2(0,0), m_Flags == 0.

Methods

  • This type defines no methods. It is a data-only container.

Usage Example

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

// Create buffer on an entity and populate it
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = em.CreateEntity();

// Add the DynamicBuffer<SubMeshGroup> (InternalBufferCapacity is set to 0 in the type)
var buffer = em.AddBuffer<SubMeshGroup>(e);

// Add a group that covers submeshes 0..2 (start=0, count=3) with one subgroup
buffer.Add(new SubMeshGroup {
    m_SubGroupCount = 1,
    m_SubMeshRange = new int2(0, 3),
    m_Flags = MeshGroupFlags.None
});

Notes: - Use DynamicBuffer to read/write these elements from systems. - The meaning of MeshGroupFlags is defined in the MeshGroupFlags enum; check that definition for available flags and their semantics.