Skip to content

Game.UI.Editor.EditorTutorialsUISystem

Assembly:
Namespace: Game.UI.Editor

Type: class

Base: TutorialsUISystem

Summary:
Editor-specific UI system that adapts the generic TutorialsUISystem for the in-editor tutorial experience. It hooks up UI bindings under the "editorTutorials" group, exposes tutorial state (enabled/disabled, current mode, next tutorial, active tutorial and phase, categories and lists), and provides editor-specific handlers for completing intro/tutorial phases and toggling tutorials. This system uses an EditorTutorialSystem (m_TutorialSystem) as its backing tutorial logic and interacts with prefab/query data to populate tutorial categories. It is marked as CompilerGenerated and uses Preserve on some members to avoid stripping.


Fields

  • private const string kEditorGroup
    Constant string key for the UI binding group ("editorTutorials").

  • private EntityQuery m_TutorialCategoryQuery
    EntityQuery used to find tutorial category prefabs / UI objects (queries UIEditorTutorialGroupData and UIObjectData components).

  • private bool m_EditorTutorialsDisabled
    Local flag tracked for whether editor tutorials are disabled; exposed to the UI via a GetterValueBinding.

Properties

  • None declared in this class.
    Note: several members used in this class (for example m_TutorialSystem, m_PrefabSystem, m_UnlockQuery and various binding fields) are inherited from the base TutorialsUISystem.

Constructors

  • public EditorTutorialsUISystem()
    Default constructor. Marked with [Preserve] attribute in source for the constructor and some methods to prevent managed stripping.

Methods

  • protected override void OnCreate()
    Initializes the system: obtains the EditorTutorialSystem instance (m_TutorialSystem), sets up m_TutorialCategoryQuery, configures m_UnlockQuery, initializes the m_EditorTutorialsDisabled flag, and registers numerous UI bindings:
  • GetterValueBindings for: tutorialsDisabled, tutorialsEnabled, introActive, listIntroActive, listOutroActive, next, advisorPanelVisible.
  • RawValueBindings for: categories (BindCategories), activeTutorial (BindTutorial), activeTutorialPhase (BindTutorialPhase) and activeList (base.BindActiveTutorialList).
  • TriggerBindings for: completeListIntro (CompleteEditorIntro) and toggleTutorials (ToggleTutorials).

These bindings expose tutorial state to the UI under the "editorTutorials" group.

  • private NativeList<UIObjectInfo> GetSortedCategories(Allocator allocator)
    Collects entities matching m_TutorialCategoryQuery, builds a NativeList for top-level categories (where UIObjectData.m_Group == Entity.Null), sorts them by priority, disposes temporary arrays, and returns the sorted list. Used to produce ordered categories for the UI.

  • private void BindCategories(IJsonWriter writer)
    Writes the JSON array for tutorial categories to the provided IJsonWriter. For each sorted category:

  • Resolves the UITutorialGroupPrefab via m_PrefabSystem.GetPrefab(entity).
  • Writes a JSON object with properties: entity, name (prefab.name), shown (whether TutorialShown component exists on the entity), locked (always false here), and children (delegates to BindTutorialGroup to write child tutorials).
  • Disposes the NativeList when done.

  • protected override void OnUpdate()
    Overrides update logic to only call base.OnUpdate() when the GameManager's current game mode is not the runtime "Game" mode. This ensures editor tutorial UI updates don't run in standard gameplay.

  • private void CompleteEditorIntro(bool value)
    Handler for the "completeListIntro" trigger: sets the tutorial mode to Default and sets tutorialEnabled to the provided value.

  • protected override void CompleteActiveTutorialPhase()
    Editor-specific completion: if the current gameMode is Editor, calls m_TutorialSystem.CompleteCurrentTutorialPhase() to advance the active tutorial phase.

  • private void ToggleTutorials()
    Toggles m_TutorialSystem.tutorialEnabled. If tutorials are enabled by the toggle, the method calls EditorTutorialSystem.OnResetTutorials() (obtained via World.DefaultGameObjectInjectionWorld.GetExistingSystemManaged()) to reset tutorial state.

Usage Example

[Preserve]
protected override void OnCreate()
{
    base.OnCreate();
    // obtain editor-specific tutorial system
    m_TutorialSystem = base.World.GetOrCreateSystemManaged<EditorTutorialSystem>();
    // create a query for tutorial category prefabs / UI objects
    m_TutorialCategoryQuery = GetEntityQuery(ComponentType.ReadOnly<UIEditorTutorialGroupData>(), ComponentType.ReadOnly<UIObjectData>());
    // expose whether editor tutorials are disabled to the UI
    m_EditorTutorialsDisabled = true;
    AddUpdateBinding(new GetterValueBinding<bool>("editorTutorials", "tutorialsDisabled", () => m_EditorTutorialsDisabled));
    // other bindings are added similarly...
}