Game.Prefabs.TutorialAdvisorActivation
Assembly:
Assembly-CSharp
Namespace:
Game.Prefabs
Type:
public class
Base:
TutorialActivation (Game.Tutorials.TutorialActivation)
Summary:
A prefab activation component used by the tutorial system to mark tutorial prefabs that should carry AdvisorActivationData. The class is exposed to the Unity Component menu under "Tutorials/Activation/" for TutorialPrefab and TutorialListPrefab types. It overrides prefab/component composition methods to ensure the AdvisorActivationData ECS component is present on created prefab entities so the tutorial/advisor systems can activate advisor behavior when the prefab is instantiated.
Fields
- None.
This class declares no instance fields.
Properties
- None.
No public or private properties are declared on this type.
Constructors
public TutorialAdvisorActivation()
This class has no explicit constructor in source; the default parameterless constructor is used. Instances are typically added to Unity prefabs via the Component menu or created by Unity when loading scenes/prefabs.
Methods
-
public override void GetArchetypeComponents(HashSet<ComponentType> components)
This override is intentionally empty. It does not contribute any components to the pure archetype composition step. -
public override void GetPrefabComponents(HashSet<ComponentType> components)
Calls the base implementation and then addsComponentType.ReadWrite<AdvisorActivationData>()
to the provided set. This ensures that prefab entities created from this prefab will include the AdvisorActivationData component (read/write), which the tutorial/advisor systems rely on.
Notes:
- ComponentType
is from Unity.Entities; adding ComponentType.ReadWrite<T>()
indicates the prefab entities will have the T component in a read/write manner.
- AdvisorActivationData
is the ECS component (struct) that carries data or flags used by the advisor/tutor systems.
Usage Example
// Attach this component to a TutorialPrefab (via Component Menu -> Tutorials/Activation/)
// so that prefab entities include AdvisorActivationData when spawned.
[ComponentMenu("Tutorials/Activation/", new Type[]
{
typeof(TutorialPrefab),
typeof(TutorialListPrefab)
})]
public class TutorialAdvisorActivation : TutorialActivation
{
public override void GetArchetypeComponents(HashSet<ComponentType> components)
{
// intentionally left empty
}
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
base.GetPrefabComponents(components);
components.Add(ComponentType.ReadWrite<AdvisorActivationData>());
}
}
Additional information: - Use this component when you want a tutorial-related prefab to trigger or be tracked by the advisor subsystem in Cities: Skylines 2. Adding it to a prefab from the editor ensures the necessary ECS component is present at prefab instantiation time.