Skip to content

Game.Prefabs.TutorialInfoviewActivation

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: class

Base: TutorialActivation

Summary:
TutorialInfoviewActivation is a prefab/component used by the tutorial system to link a tutorial activation to an Infoview prefab. It ensures the tutorial entity gets an InfoviewActivationData component that references the Infoview prefab's entity and advertises the required component types and prefab dependencies to the prefab system. The class relies on the PrefabSystem and Unity.Entities EntityManager to resolve and store the linked Infoview entity.


Fields

  • public InfoviewPrefab m_Infoview
    This field stores a reference to the Infoview prefab that the tutorial activation will target. It is annotated with [NotNull], indicating the reference is required and should not be null.

(No other instance fields are declared in this class.)

Properties

  • This class does not declare any public properties of its own. It inherits any properties available from its base class, TutorialActivation.

Constructors

  • public TutorialInfoviewActivation()
    The class uses the default parameterless constructor (not explicitly declared in the source). Initialization logic is performed in the overridden lifecycle methods rather than a constructor.

Methods

  • public override void GetDependencies(List<PrefabBase> prefabs)
    Adds prefab dependencies required by this tutorial activation. Implementation:
  • Calls base.GetDependencies(prefabs).
  • Adds m_Infoview to the prefabs list so the Infoview prefab is included as a dependency when this tutorial prefab is processed.

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Advertises the ECS component types this prefab will require on its entity. Implementation:

  • Calls base.GetPrefabComponents(components).
  • Adds ComponentType.ReadWrite() to the components set. This informs the prefab pipeline that entities produced by this prefab will need an InfoviewActivationData component.

  • public override void LateInitialize(EntityManager entityManager, Entity entity)
    Performs late-stage initialization when prefab entities are being prepared. Implementation:

  • Calls base.LateInitialize(entityManager, entity).
  • Retrieves the runtime PrefabSystem via entityManager.World.GetExistingSystemManaged().
  • Uses PrefabSystem.TryGetEntity(m_Infoview, out var entity2) to resolve the Infoview prefab into its Entity.
  • If resolved, sets the InfoviewActivationData component on the provided entity to reference the Infoview entity (entity2), using entityManager.SetComponentData(entity, new InfoviewActivationData(entity2)).

Notes: - This ensures the tutorial entity carries a direct Entity reference to the Infoview prefab instance to be activated by the tutorial logic.

  • public override void GenerateTutorialLinks(EntityManager entityManager, NativeParallelHashSet<Entity> linkedPrefabs)
    Generates links between this tutorial prefab and other prefabs it references so the tutorial system can track relationships. Implementation:
  • Calls base.GenerateTutorialLinks(entityManager, linkedPrefabs).
  • Retrieves the PrefabSystem via entityManager.World.GetExistingSystemManaged().
  • Adds the entity for m_Infoview into the linkedPrefabs set using existingSystemManaged.GetEntity(m_Infoview).

Notes: - This method ensures the tutorial system is aware of the relationship between the tutorial activation and the Infoview prefab for dependency traversal, packaging, or loading ordering.

Usage Example

// Example: How this prefab class wires the Infoview prefab into the tutorial entity.
// The prefab system calls LateInitialize when constructing the tutorial entity.
public class SomePrefabProcessor
{
    void InitializeTutorialPrefab(EntityManager entityManager, Entity tutorialEntity, TutorialInfoviewActivation activation)
    {
        // During prefab initialization the engine will call:
        activation.LateInitialize(entityManager, tutorialEntity);

        // After LateInitialize, the tutorialEntity will have an InfoviewActivationData
        // component referencing the Infoview prefab's Entity (if the Infoview prefab resolved).
    }
}

Additional notes: - The class depends on PrefabSystem being available from the EntityManager.World; it uses GetExistingSystemManaged() which will return the managed system instance. - The InfoviewActivationData component is assumed to be a simple component struct that stores an Entity reference (the Infoview entity) used by tutorial runtime systems to activate or interact with the Infoview UI element. Ensure the Infoview prefab is assigned in the inspector for this prefab to function correctly.