Skip to content

Game.Prefabs.TutorialsConfigurationPrefab

Assembly:
Assembly-CSharp (inferred)
{{ This class lives in the game's main assembly (commonly "Assembly-CSharp") as part of the Prefabs code for the mod/game. }}

Namespace:
Game.Prefabs
{{ Contains prefab definitions used to configure gameplay/tutorial related assets. }}

Type:
class
{{ Public prefab class used by the game's prefab system. It is decorated with Unity/Colossal attributes to place it in the editor component menu. }}

Base:
PrefabBase
{{ Inherits prefab lifecycle behavior from PrefabBase and overrides dependency, component registration and initialization hooks. }}

Summary:
TutorialsConfigurationPrefab holds references to prefab assets used by the game's tutorial system (an intro tutorial list and a map-tiles feature) and registers the corresponding TutorialsConfigurationData component on the entity. During LateInitialize it resolves the referenced prefabs to entities and writes those entity handles into the TutorialsConfigurationData component on the prefab's entity.
{{ This prefab acts as a simple configuration holder that the runtime can read (via the TutorialsConfigurationData component) to know which tutorial list and map tiles feature to use. It enforces that both referenced prefabs are present (NotNull). }}


Fields

  • public TutorialListPrefab m_TutorialsIntroList
    {{ Reference to the TutorialListPrefab that contains the intro/tutorial sequence. Marked [NotNull], so it is required to be assigned. This field is added as a dependency in GetDependencies so the prefab system ensures it is loaded before this configuration. }}

  • public FeaturePrefab m_MapTilesPrefab
    {{ Reference to the FeaturePrefab describing map tiles used by the tutorial/configuration. Also required (NotNull) and added to the dependencies list during GetDependencies. }}

Properties

  • (none)
    {{ This class does not declare CLR properties; it exposes public fields and overrides methods from PrefabBase. }}

Constructors

  • public TutorialsConfigurationPrefab()
    {{ No custom constructor is provided in source — the class relies on the default parameterless constructor generated by the compiler. Initialization of references is expected to be done in the editor/inspector or by the prefab system. }}

Methods

  • public override void GetDependencies(List<PrefabBase> prefabs)
    {{ Calls base.GetDependencies(prefabs) and then adds m_TutorialsIntroList and m_MapTilesPrefab to the provided list. This ensures the referenced prefabs are treated as dependencies and will be created/loaded before this prefab is initialized. }}

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    {{ Calls base.GetPrefabComponents(components) and then adds ComponentType.ReadWrite() to the set. This registers that entities created from this prefab will have a TutorialsConfigurationData component (read/write). }}

  • public override void LateInitialize(EntityManager entityManager, Entity entity)
    {{ During LateInitialize the prefab resolves the referenced prefabs to runtime entities using the PrefabSystem:

  • Retrieves PrefabSystem from the world (existing managed system).
  • Calls GetEntity(m_TutorialsIntroList) and GetEntity(m_MapTilesPrefab) to obtain the corresponding Entity instances.
  • Writes a TutorialsConfigurationData struct into the provided entity via entityManager.SetComponentData, populating m_TutorialsIntroList and m_TilesFeature (named m_TutorialsIntroList and m_TilesFeature / m_TilesFeature equivalent) with those entities.

This is the critical step that links the prefab references to entity handles so runtime systems can read them. }}

Usage Example

// Example: reading the configured entities at runtime
var prefabSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystemManaged<PrefabSystem>();
Entity configEntity = prefabSystem.GetEntity(tutorialsConfigurationPrefab); // tutorialsConfigurationPrefab is a TutorialsConfigurationPrefab instance
var configData = entityManager.GetComponentData<TutorialsConfigurationData>(configEntity);

// configData.m_TutorialsIntroList and configData.m_TilesFeature are Entity handles
// that can be used by systems to look up the actual tutorial list and map tiles features.

{{ Notes: - The class is decorated with [ComponentMenu("Settings/")] so it appears under Settings in editor menus. - Fields are annotated [NotNull], so they should be set in the inspector; otherwise initialization may fail. - The TutorialsConfigurationData struct must exist and have fields matching the assignments done in LateInitialize (entities for the intro list and the map tiles feature). - This prefab does not create entities itself; it supplies component data on its prefab entity which other runtime systems consume. }}