Class GameModeSettingsCreator
Generates (or updates) a UnityGameModeSettingsDefinition — the flow state machine driving Menu/Game/Pause, action-map switching, pause behavior, and the per-mode transition signal lists. Today the only tool that creates this asset is the one-shot Initialize Serenity wizard (via a generic recipe asset with a single field populated); this is the first dedicated creation wizard for the aggregate.
Resolution mirrors Serenity.Logging.Infrastructure.Editor.Builder.LoggingProfileCreator's
UnityLogProfile, not its two sink settings. UnitySerenityInstaller.GameModeSettingsDefinition
is assigned directly on the composition root — nothing resolves it by Addressables label at runtime
(unlike, say, the Logging sinks, which the installer loads via module:logging) — so more than one
UnityGameModeSettingsDefinition can legitimately exist in a project (e.g. one per build
configuration), exactly like the project's own shipped Logging profiles. A settings asset therefore
resolves by Id within OutputFolderPath.
It is still retagged with GAME_MODE on creation for inventory consistency, even
though nothing loads it by that label today.
The Input Asset field is authoring-only. UnityGameModeService never reads
InputAsset at runtime — SetActionMap calls
IPlayerInputService.SetActionMap(name), and BindPauseAction reflects the actual
PlayerInput.actions asset off the player-input service. The field exists solely so
UnityGameModeSettingsDefinitionEditor (and this wizard) can render action-map name dropdowns
instead of free-text fields. Consequently this wizard cross-checks it against the project's own
InputAsset (when exactly one such settings asset exists)
and warns — never blocks — on a mismatch, since a different asset here would silently populate the
dropdowns with map names that do not exist in the asset actually switched at runtime.
Transition signals are polymorphic instances, not string ids.
Signals /
ExitSignals are [SerializeReference] List<EventDispatcherSignal> — this wizard
authors instances of the chosen concrete types (using the same
EventDispatcherSignalTypePicker type catalog the inspector and this wizard both draw from),
mirroring what UnityGameModeSettingsDefinitionEditor's own "Add" button does. Deep per-signal
field configuration (e.g. a music-track reference inside a custom signal) remains the Inspector's job —
unchanged by this wizard. Replacing a group is therefore preserve-by-position-and-type (see
Serenity.GameMode.Installation.Editor.Builder.GameModeSettingsCreator.ComputeReplacementSignalList(System.Collections.Generic.IReadOnlyList{Serenity.EventDispatcher.Domain.Entities.EventDispatcherSignal},System.Collections.Generic.List{Serenity.GameMode.Installation.Editor.Builder.GameModeSettingsCreator.TransitionSignalRow})): the existing instance at a position survives, hand-configured
fields intact, when the row at that position still asks for the same concrete type; only a
changed/added/removed position creates a fresh default or drops the old instance, and Create(Input)
warns with an exact count whenever it does.
Inherited Members
Namespace: Serenity.GameMode.Installation.Editor.Builder
Assembly: Serenity.UnityGameMode.Installation.Editor.dll
Syntax
public static class GameModeSettingsCreator
Fields
DefaultOutputFolder
Folder a brand-new settings asset is created under when the caller names none.
Declaration
public const string DefaultOutputFolder = "Assets/Game/Media/GameMode"
Field Value
| Type | Description |
|---|---|
| string |
Methods
Create(Input)
Validates the request, then resolves-or-creates the settings asset, applying every field and every touched transition-signal group. On any failure every mutation is rolled back through the transaction's existing-asset restores: an already-existing asset — including the whole per-mode transition-signal list, touched or not — has its pre-call state restored first, and only then is a newly created asset deleted along with its Addressables entry. Restoring the whole list rather than only the touched modes is what also undoes any per-mode entry this run appended for a mode that had none before: the appended entry simply never existed in the captured state to begin with.
Declaration
public static GameModeSettingsCreator.Result Create(GameModeSettingsCreator.Input input)
Parameters
| Type | Name | Description |
|---|---|---|
| GameModeSettingsCreator.Input | input |
Returns
| Type | Description |
|---|---|
| GameModeSettingsCreator.Result |
Validate(Input)
Validates the request: a non-empty Id, a well-formed output folder, action-map names that exist in InputAsset when one is assigned (errors — switching modes would silently no-op otherwise), the hardcoded "Pause" action inside the Game map (a warning — some projects trigger pause purely from a UI signal), a mismatch against the project's own UnityPlayerInputSettingsDefinition (a warning), every transition signal type actually resolving to a concrete EventDispatcherSignal subtype (an error per unresolved row), and the same resolve-or-edit duplicate-Id warning Create(Input) would act on.
Declaration
public static SerenityCreationValidationResult Validate(GameModeSettingsCreator.Input input)
Parameters
| Type | Name | Description |
|---|---|---|
| GameModeSettingsCreator.Input | input |
Returns
| Type | Description |
|---|---|
| SerenityCreationValidationResult |