Game.Prefabs.TutorialActivation
Assembly: Unknown (Game assembly / mod assembly)
Namespace: Game.Prefabs
Type: abstract class
Base: ComponentBase
Summary:
Base class for prefab-side tutorial activation components used by the game's tutorial system. This abstract class provides hooks to declare which ECS components should exist on tutorial-related prefabs and to generate links (references) between tutorial prefabs and other entities. By default it opts out of unlock dependency checks (ignoreUnlockDependencies = true). Concrete tutorial activation components should override the provided methods to populate archetype/prefab component sets and to produce any required entity links.
Fields
- None declared in this class.
This type does not define any instance fields; subclasses may define fields as needed.
Properties
public override bool ignoreUnlockDependencies => true
Always returns true in this base class. This means prefab tutorial activation components are not subject to the usual unlock dependency checks. Subclasses inherit this behavior unless they override the property.
Constructors
- No explicit constructors declared.
The class relies on the default parameterless constructor. Subclasses can define their own constructors if needed.
Methods
-
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Empty in the base class. Intended for subclasses to add component types required for the entity archetype when this tutorial activation is used as a runtime (non-prefab) component. If your tutorial activation needs additional runtime components, add them to the provided HashSet here. -
public override void GetPrefabComponents(HashSet<ComponentType> components)
AddsTutorialActivationData
to the provided prefab component set: -
components.Add(ComponentType.ReadWrite<TutorialActivationData>());
This ensures that prefabs using this tutorial activation will include the TutorialActivationData component so the tutorial system can read/write tutorial-specific state on the prefab entity. -
public virtual void GenerateTutorialLinks(EntityManager entityManager, NativeParallelHashSet<Entity> linkedPrefabs)
Empty virtual method. Subclasses can override to create or register links between the prefab entity and other entities (for example, linking tutorial UI elements, target buildings, or other related prefabs). The EntityManager is provided to create or query entities; linkedPrefabs can be used to record which prefabs have been linked to avoid duplicate work. This method runs on the prefab processing side (not necessarily at runtime).
Usage Example
// Example subclass that ensures an extra component is included on the prefab
public class MySpecialTutorialActivation : TutorialActivation
{
public override void GetArchetypeComponents(HashSet<ComponentType> components)
{
// Add runtime components required by this tutorial activation
components.Add(ComponentType.ReadWrite<MyRuntimeComponent>());
}
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
base.GetPrefabComponents(components);
// Add additional prefab components
components.Add(ComponentType.ReadWrite<MyPrefabMarker>());
}
public override void GenerateTutorialLinks(EntityManager entityManager, NativeParallelHashSet<Entity> linkedPrefabs)
{
// Example: find or create an entity to link and record it in linkedPrefabs
// (Implementation depends on your mod's linking strategy)
}
}
Notes and tips: - TutorialActivationData is the canonical data component used by the tutorial system for prefabs with tutorial activations; do not remove it from prefab component sets if you want the tutorial logic to recognize the prefab. - Keep GenerateTutorialLinks efficient and thread-safe relative to the context where it is called; NativeParallelHashSet is provided to support concurrent operations in some pipeline stages. - Because ignoreUnlockDependencies is true by default, tutorial prefabs will bypass normal unlock gating; if you need unlock checks, override the property in your subclass.