Game.Prefabs.TutorialUITriggerPrefab
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: TutorialTriggerPrefabBase
Summary:
TutorialUITriggerPrefab defines a prefab used by the game's tutorial system to create UI-based triggers. Each prefab contains one or more UITriggerInfo entries that point to UI tag provider prefabs (PrefabBase) and optionally to target tutorial phases. The prefab:
- Registers required ECS components (UITriggerData).
- Declares dependencies on the referenced UI tag providers and optional TutorialPhasePrefabs.
- Optionally marks referenced tutorial phases with a TutorialPhaseBranch component when multiple triggers are present.
- Generates blink tags from the UI tag provider's uiTag string (split by '|'), unless blinking is disabled on a given trigger.
This prefab is intended to be authored in the editor (ComponentMenu up in "Tutorials/Triggers/") and used by the tutorial runtime to detect UI interactions and advance/branch tutorial phases.
Fields
-
public UITriggerInfo[] m_UITriggers
Array of UI trigger definitions. Each element describes a UI tag provider prefab, an optional phase to jump to when triggered, and flags to control blinking and manual completion. -
public class UITriggerInfo
(nested)
Holds data for a single UI trigger. The nested class contains: public PrefabBase m_UITagProvider
The prefab that provides the uiTag string (required). The uiTag value is split by '|' to create blink tags.public TutorialPhasePrefab m_GoToPhase
Optional. If set, the tutorial will advance to this phase when this trigger is activated. Overrides any GoToPhase configured on the parent TutorialPhasePrefab.public bool m_DisableBlinking
If true, blink tags will NOT be generated for this trigger.public bool m_CompleteManually
If true, triggering this UI does not automatically complete the tutorial step; completion must be done manually by tutorial logic.
Properties
public override bool phaseBranching { get; }
True if any UITriggerInfo in m_UITriggers has m_GoToPhase set. Indicates that this prefab causes branching between tutorial phases based on which trigger fires.
Constructors
public TutorialUITriggerPrefab()
Default parameterless constructor. Instances are typically created/managed by the Unity/Prefab authoring workflow.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds required ECS component types to the provided set. This class adds UITriggerData (read/write) so the tutorial runtime knows which components entities require. -
public override void GetDependencies(List<PrefabBase> prefabs)
Adds referenced prefabs (all m_UITagProvider entries and any m_GoToPhase entries) to the dependency list so the prefab system loads them with correct order. -
public override void LateInitialize(EntityManager entityManager, Entity entity)
Called late in prefab initialization. If this prefab defines more than one UI trigger, the method marks any referenced TutorialPhasePrefab entities (via m_GoToPhase) with a TutorialPhaseBranch component so the phase graph can represent branching. -
protected override void GenerateBlinkTags()
Generates blink tags for the tutorial UI highlighting system by reading each m_UITagProvider.uiTag, splitting on '|' and trimming tokens. Skips generation for triggers with m_DisableBlinking set to true. -
public override void GenerateTutorialLinks(EntityManager entityManager, NativeParallelHashSet<Entity> linkedPrefabs)
Adds referenced UI tag provider prefab entities to the linkedPrefabs set so the tutorial graph knows about connections between this trigger prefab and the provider prefabs.
Usage Example
// Example: create and configure a TutorialUITriggerPrefab in editor/runtime scripting
var prefab = ScriptableObject.CreateInstance<Game.Prefabs.TutorialUITriggerPrefab>();
// Suppose you already have references to PrefabBase uiProvider and TutorialPhasePrefab nextPhase
var entry = new Game.Prefabs.TutorialUITriggerPrefab.UITriggerInfo {
m_UITagProvider = uiProvider,
m_GoToPhase = nextPhase,
m_DisableBlinking = false,
m_CompleteManually = false
};
prefab.m_UITriggers = new[] { entry };
// The prefab system / editor will serialize this and the runtime will call
// GetDependencies / LateInitialize / GenerateBlinkTags / GenerateTutorialLinks as appropriate.