Skip to content

Game.Tutorials.TutorialPhaseData

Assembly:
Assembly-CSharp (typical for game scripts / mods)

Namespace:
Game.Tutorials

Type:
struct

Base:
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
Represents a single tutorial phase descriptor used with the ECS (IComponentData) in the game's tutorial system. Carries an identifier for the phase (m_Type) and an optional override value that can change how long the phase takes to complete (m_OverrideCompletionDelay). This component is intended to be attached to tutorial-related entities so systems can query and act on the current tutorial phase.


Fields

  • public Game.Tutorials.TutorialPhaseType m_Type
    Identifies which tutorial phase this component represents. Typically an enum defined elsewhere (TutorialPhaseType) that lists the different tutorial steps or states.

  • public System.Single m_OverrideCompletionDelay
    Optional override for the phase completion delay (in seconds). When set to a positive value, systems that respect this field can use it instead of a default delay to determine when the phase is considered complete. If left at 0 (or not used), the default timing logic of the tutorial system is expected to apply.

Properties

  • This type has no properties. It exposes two public fields (as is common for lightweight ECS components).

Constructors

  • public TutorialPhaseData() (implicit default struct constructor)
    Structs provide a default parameterless constructor that initializes fields to their default values (m_Type default enum value, m_OverrideCompletionDelay = 0f). You can also initialize the struct with an object initializer.

Methods

  • This type defines no methods. It is a plain data container implementing IComponentData and IQueryTypeParameter for ECS usage.

Usage Example

// Example: create an entity and attach TutorialPhaseData to it
using Unity.Entities;
using Game.Tutorials;

public class TutorialBootstrap
{
    public void CreatePhase(EntityManager entityManager)
    {
        Entity entity = entityManager.CreateEntity(typeof(TutorialPhaseData));

        var phaseData = new TutorialPhaseData
        {
            m_Type = TutorialPhaseType.Introduction, // example enum value
            m_OverrideCompletionDelay = 2.5f         // override completion to 2.5 seconds
        };

        entityManager.SetComponentData(entity, phaseData);
    }
}

// Example: reading the component inside a SystemBase
public class TutorialSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Query entities with TutorialPhaseData and process them
        Entities.ForEach((ref TutorialPhaseData phase) =>
        {
            // Use phase.m_Type and phase.m_OverrideCompletionDelay here
        }).Schedule();
    }
}