Skip to content

Game.Prefabs.CullingGroupData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType (implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter)

Summary:
CullingGroupData is a lightweight ECS component used to tag an entity with a culling-group index. The component exposes a single integer field (m_GroupIndex) that typically identifies which culling group the entity (usually a prefab instance) belongs to. Game systems can use this index to perform visibility/culling decisions, group-based processing, or selective updates for entities in the same culling group.


Fields

  • public int m_GroupIndex
    Holds the integer index identifying the culling group for the entity. Typical usage: store a small non-negative index that maps to a culling group managed elsewhere in the game (for example, a grouping used by the renderer or a custom culling system). There is no validation in the struct itself — ensure the index is consistent with the culling system that consumes it.

Properties

  • None

Constructors

  • Default (implicit) constructor public CullingGroupData()
    The struct uses the implicit default constructor provided by C#. No explicit constructors are defined in the source file. Initialize via object initializer or SetComponentData/AddComponentData.

Methods

  • None

Usage Example

// Example: adding the component to an entity and setting the group index
var entity = entityManager.CreateEntity(typeof(SomeRenderablePrefabComponent));
entityManager.AddComponentData(entity, new CullingGroupData { m_GroupIndex = 2 });

// Example: reading the component in a SystemBase
protected override void OnUpdate()
{
    Entities
        .ForEach((ref CullingGroupData culling) =>
        {
            int group = culling.m_GroupIndex;
            // perform culling/group-based logic here
        }).ScheduleParallel();
}