Skip to content

Game.Tutorials.TutorialPhaseRef

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

Type: struct

Base: System.ValueType, implements Unity.Entities.IBufferElementData

Summary:
Represents a single reference to a tutorial phase as an ECS dynamic buffer element. Use this element type to store one or more tutorial phase Entity references on another entity (for example, a tutorial manager or sequence holder). This struct is a simple container around an Entity and is intended to be used with Unity.Entities.DynamicBuffer.


Fields

  • public Entity m_Phase
    Stores the Entity that represents a tutorial phase. This is the data carried by the buffer element; each element in a DynamicBuffer holds one phase Entity.

Properties

  • (none)

Constructors

  • public TutorialPhaseRef(Entity phase)
    Creates a new buffer element wrapping the provided phase Entity. Use this to add elements to a DynamicBuffer.

Methods

  • (none — plain data container)

Usage Example

// Example inside a SystemBase or other ECS code:

// Add a buffer to an entity (e.g., a tutorial manager entity)
var managerEntity = entityManager.CreateEntity();
var buffer = entityManager.AddBuffer<TutorialPhaseRef>(managerEntity);

// Suppose you have some phase entities already created:
Entity phaseA = /* created elsewhere */;
Entity phaseB = /* created elsewhere */;

// Add phases to the buffer
buffer.Add(new TutorialPhaseRef(phaseA));
buffer.Add(new TutorialPhaseRef(phaseB));

// Reading the buffer later in a system (SystemBase):
Entities
    .WithAll<SomeComponent>() // filter for entities that hold the buffer
    .ForEach((Entity e, DynamicBuffer<TutorialPhaseRef> phases) =>
    {
        for (int i = 0; i < phases.Length; i++)
        {
            Entity phaseEntity = phases[i].m_Phase;
            // operate on phaseEntity, e.g., check components or send messages
        }
    }).Schedule();