Skip to content

Game.Prefabs.TutorialControlSchemeActivation

Assembly: Assembly-CSharp

Namespace: Game.Prefabs

Type: class

Base: TutorialActivation

Summary:
A prefab component used by the tutorial system to mark a tutorial prefab with a required input control scheme. When the prefab is converted to an ECS entity, this component ensures a ControlSchemeActivationData component is added to the entity and initialized with the selected InputManager.ControlScheme value. The class is exposed in the Unity component menu under "Tutorials/Activation/". This allows tutorials to be gated or triggered only when the player is using a particular control scheme (for example, keyboard/mouse or gamepad).


Fields

  • public InputManager.ControlScheme m_ControlScheme
    Exposed inspector field that specifies which control scheme this tutorial activation requires. The value is read during prefab->entity initialization and written into the ControlSchemeActivationData component on the entity.

Properties

  • This class does not declare any properties.

Constructors

  • public TutorialControlSchemeActivation()
    Default parameterless constructor (implicit). No special construction logic is defined in the class source.

Methods

  • public override void GetArchetypeComponents(HashSet<ComponentType> components)
    This override is intentionally empty in the current implementation — the activation does not add any ECS archetype-only components at archetype creation time.

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Calls the base implementation, then adds ComponentType.ReadWrite() to the provided components set. This registers that the prefab will contain the ControlSchemeActivationData component when converted to an entity.

  • public override void Initialize(EntityManager entityManager, Entity entity)
    Calls the base initialization, then writes the ControlSchemeActivationData to the entity using the m_ControlScheme value: entityManager.SetComponentData(entity, new ControlSchemeActivationData(m_ControlScheme)); This ensures the runtime entity receives the selected control-scheme requirement.

Notes: This class depends on the InputManager.ControlScheme enum and the ControlSchemeActivationData ECS component/struct. It integrates with the game's prefab -> ECS conversion pipeline and the tutorial system's activation checks.

Usage Example

// Typical usage: attach this component to a tutorial prefab and select the desired control scheme
// in the inspector. During prefab->entity conversion the following will occur in Initialize:
// entityManager.SetComponentData(entity, new ControlSchemeActivationData(m_ControlScheme));

// Programmatically adding/setting it:
var go = new GameObject("TutorialPrefab");
var activation = go.AddComponent<TutorialControlSchemeActivation>();
activation.m_ControlScheme = InputManager.ControlScheme.Gamepad;

// When the prefab is converted, ControlSchemeActivationData will be added to the entity and
// initialized with the selected control scheme so tutorial logic can check/require it.