Game.Prefabs.UpdateFrameData
Assembly:
Assembly-CSharp (default game assembly)
Namespace:
Game.Prefabs
Type:
struct
Base:
IComponentData, IQueryTypeParameter
Summary:
A small ECS component used to tag an entity with an update group index for frame-update organization. Typically used in the game's systems to categorize or order per-frame updates by grouping entities into an "update group" identified by an integer index. Implementing IQueryTypeParameter also allows this type to be used as a query parameter in certain optimized queries.
Fields
public System.Int32 m_UpdateGroupIndex
Stores the integer index of the update group. The value defines which update group this component/entity belongs to and is read by systems that schedule or group updates per frame.
Properties
- None. This struct exposes a public field and does not provide properties.
Constructors
public UpdateFrameData(int updateGroupIndex)
Constructs the component with the given update group index. Use this to set the group when adding or setting the component on an entity.
Methods
- None. This is a plain data component (IComponentData) without behavior methods.
Usage Example
// Add or set the component on an entity
var world = Unity.Entities.World.DefaultGameObjectInjectionWorld;
var em = world.EntityManager;
var archetype = em.CreateArchetype(typeof(Game.Prefabs.UpdateFrameData));
// Create entity with the component already present
var entity = em.CreateEntity(archetype);
em.SetComponentData(entity, new Game.Prefabs.UpdateFrameData(updateGroupIndex: 2));
// Or add/set on an existing entity
// em.AddComponentData(existingEntity, new Game.Prefabs.UpdateFrameData(1));
// em.SetComponentData(existingEntity, new Game.Prefabs.UpdateFrameData(3));
// Example: using the component in a SystemBase query
// Entities
// .WithAll<Game.Prefabs.UpdateFrameData>()
// .ForEach((ref Game.Prefabs.UpdateFrameData ufd) => {
// // read ufd.m_UpdateGroupIndex to decide per-entity update behavior
// }).Schedule();