Skip to content

Game.Tutorials.TutorialPhaseBranch

Assembly: Assembly-CSharp
Namespace: Game.Tutorials

Type: struct

Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
TutorialPhaseBranch is an empty/tag component used by the game's tutorial system to mark entities that participate in tutorial phase branching logic. It is defined with a fixed size and layout ([StructLayout(LayoutKind.Sequential, Size = 1)]) to ensure a non-zero size when used as an ECS component. Implementing IComponentData makes it a Unity ECS component, and implementing IQueryTypeParameter allows it to be used directly in query builder APIs (e.g., WithAll).


Fields

  • This struct defines no instance fields. It is an intentional "tag" or marker component.
    The source applies the attribute [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure the component occupies one byte in memory rather than being a zero-sized type.

Properties

  • This type exposes no properties.

Constructors

  • public TutorialPhaseBranch()
    This type uses the compiler-generated, parameterless constructor. Instances are value types and will be zero-initialized when created by ECS or via default(TutorialPhaseBranch).

Methods

  • This type declares no methods.

Usage Example

// Add the tag to an existing entity
EntityManager.AddComponent<TutorialPhaseBranch>(entity);

// Create an entity that already has the tag
var archetype = EntityManager.CreateArchetype(typeof(TutorialPhaseBranch), typeof(SomeOtherComponent));
Entity tutorialBranchEntity = EntityManager.CreateEntity(archetype);

// Query for entities that have the tag and run logic in a SystemBase
public partial class TutorialBranchSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Using IQueryTypeParameter enables patterns like WithAll<TutorialPhaseBranch>()
        Entities
            .WithAll<TutorialPhaseBranch>()
            .ForEach((Entity e, in SomeOtherComponent comp) =>
            {
                // Branching logic for tutorial phases goes here
            })
            .Schedule();
    }
}