Skip to content

Game.Prefabs.TutorialUIActivation

Assembly: Assembly-CSharp (game/mod assembly)
Namespace: Game.Prefabs

Type: class

Base: TutorialActivation

Summary:
A prefab activation component used by the tutorial system to connect a tutorial activation to a UI tag provider prefab. It declares a dependency on a UI tag provider, controls whether the UI activation can be deactivated, writes a UIActivationData component into the prefab entity during initialization, and generates a tutorial link to the UI tag provider's entity.


Fields

  • public PrefabBase m_UITagProvider
    A reference to the prefab that provides the UI tag used by the tutorial. Marked with [NotNull], so this should be set to a valid prefab in the editor/definition. This prefab is added as a dependency and linked during GenerateTutorialLinks.

  • public bool m_CanDeactivate = true
    Controls whether the UI activation can be deactivated by the player/system. The value is written into the UIActivationData component during Initialize.

Properties

  • None.

Constructors

  • public TutorialUIActivation()
    Default constructor (no custom construction logic in the source file). All initialization occurs via fields and the overridden lifecycle methods.

Methods

  • public override void GetDependencies(List<PrefabBase> prefabs)
    Adds m_UITagProvider to the provided list of prefab dependencies in addition to the base class dependencies. Ensures the UI tag provider prefab is included when resolving prefab dependency graphs.

  • public override void GetArchetypeComponents(HashSet<ComponentType> components)
    No archetype components are added by this class (method intentionally empty). Archetype components remain as defined by base classes or other prefab components.

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Calls the base implementation and adds ComponentType.ReadWrite() to the prefab components. This ensures the resulting prefab entity will contain a UIActivationData component.

  • public override void Initialize(EntityManager entityManager, Entity entity)
    Calls the base Initialize, then sets the UIActivationData component on the prefab entity using the m_CanDeactivate value: entityManager.SetComponentData(entity, new UIActivationData(m_CanDeactivate));

  • public override void GenerateTutorialLinks(EntityManager entityManager, NativeParallelHashSet<Entity> linkedPrefabs)
    Calls the base implementation, then obtains the PrefabSystem from the world and adds the entity for m_UITagProvider to linkedPrefabs: PrefabSystem existingSystemManaged = entityManager.World.GetExistingSystemManaged(); linkedPrefabs.Add(existingSystemManaged.GetEntity(m_UITagProvider));

This creates a link between this tutorial prefab and the UI tag provider prefab so the tutorial system can find and reference the UI provider at runtime.

Usage Example

// Example showing the Initialize override behavior (from the class)
public override void Initialize(EntityManager entityManager, Entity entity)
{
    base.Initialize(entityManager, entity);
    // Writes the UIActivationData component to the prefab entity using the configured value
    entityManager.SetComponentData(entity, new UIActivationData(m_CanDeactivate));
}