Skip to content

Game.Prefabs.ForceUIGroupUnlockData

Assembly: Game (inferred)
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
A simple buffer element used to request/record that a specific Entity's UI group should be unlocked. This struct contains only an Entity reference and is intended to be stored in a DynamicBuffer on an entity or prefab so systems can process requests to force-unlock UI groups. It is a plain IBufferElementData with no behavior; actual unlocking logic must be implemented by a system that reads this buffer.


Fields

  • public Unity.Entities.Entity m_Entity
    Holds the Entity whose UI group should be unlocked. Add instances of this element to a dynamic buffer to signal a request for unlocking that entity's UI group.

Properties

  • This type has no properties.

Constructors

  • public ForceUIGroupUnlockData()
    The default (parameterless) constructor is provided by the compiler. You can initialize the field inline when adding to a buffer, e.g. new ForceUIGroupUnlockData { m_Entity = targetEntity }.

Methods

  • This type defines no methods. It is a plain data container (IBufferElementData).

Usage Example

// Example inside a SystemBase or ISystem-based system
protected override void OnUpdate()
{
    var em = EntityManager;
    var ecb = new EntityCommandBuffer(Unity.Collections.Allocator.Temp);

    // Suppose 'requester' is an entity that should hold the buffer, and 'target' is the entity
    // whose UI group we want to force-unlock.
    Entity requester = /* obtain or create the requester entity */;
    Entity target = /* the entity whose UI group to unlock */;

    // Ensure the buffer exists (or add it)
    if (!em.HasComponent<ForceUIGroupUnlockData>(requester))
        em.AddBuffer<ForceUIGroupUnlockData>(requester);

    // Add a buffer element to request the unlock
    var buffer = em.GetBuffer<ForceUIGroupUnlockData>(requester);
    buffer.Add(new ForceUIGroupUnlockData { m_Entity = target });

    // Alternatively, when scheduling structural changes use an EntityCommandBuffer:
    var buf = ecb.AddBuffer<ForceUIGroupUnlockData>(requester);
    buf.Add(new ForceUIGroupUnlockData { m_Entity = target });

    ecb.Playback(em);
    ecb.Dispose();
}

Notes: - Process these buffer entries in a separate system that reads DynamicBuffer and performs the actual UI-unlock behavior, then clears or removes processed entries as appropriate. - For thread-safe modifications from jobs, use EntityCommandBuffer or parallel-safe buffer APIs.