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
BuildTransitionRowsFromExisting(UnityGameModeSettingsDefinition)
Reconstructs GameModeSettingsCreator.TransitionSignalRow entries from existing's own
read-only accessors — the seed CreateGameModeSettingsWindow reseeds
_transitionRows from on a retarget, mirroring
Serenity.SequencePlayer.Infrastructure.Editor.Builder.SequenceDefinitionRowSeed.FromSettings's
own reason for existing: without it, an update-in-place run's Transitions step shows an empty list for
an asset that already has signals configured, even though Serenity.GameMode.Installation.Editor.Builder.GameModeSettingsCreator.ApplyTransitionSignals(System.Collections.Generic.List{Serenity.GameMode.Installation.Editor.Builder.GameModeSettingsCreator.TransitionSignalRow},Serenity.GameMode.Installation.Settings.UnityGameModeSettingsDefinition) itself
never touches a (mode, direction) group absent from the input.
Declaration
public static List<GameModeSettingsCreator.TransitionSignalRow> BuildTransitionRowsFromExisting(UnityGameModeSettingsDefinition existing)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityGameModeSettingsDefinition | existing |
Returns
| Type | Description |
|---|---|
| List<GameModeSettingsCreator.TransitionSignalRow> |
Create(Input)
Validates the request, resolves the existing settings asset (if any) to seed a THROWAWAY scratch draft from it — so Serenity.GameMode.Installation.Editor.Builder.GameModeSettingsCreator.ApplyTransitionSignals(System.Collections.Generic.List{Serenity.GameMode.Installation.Editor.Builder.GameModeSettingsCreator.TransitionSignalRow},Serenity.GameMode.Installation.Settings.UnityGameModeSettingsDefinition)'s preserve-by-position rule compares against the REAL current signal instances, not a blank template — applies every field and every touched transition-signal group onto that draft, then commits it through CreateFromDraft(UnityGameModeSettingsDefinition, string, string, bool). This is the headless/test/recipe entry point ONLY — a flat GameModeSettingsCreator.Input shape mapped onto a scratch draft this method builds and disposes itself. CreateGameModeSettingsWindow never calls this: it commits its own LIVE, long-lived draft (see Serenity.Global.Infrastructure.Editor.SerenityWizardByIdAssetBinding<>) directly through CreateFromDraft(UnityGameModeSettingsDefinition, string, string, bool), which is the single write path both callers share.
Declaration
public static GameModeSettingsCreator.Result Create(GameModeSettingsCreator.Input input)
Parameters
| Type | Name | Description |
|---|---|---|
| GameModeSettingsCreator.Input | input |
Returns
| Type | Description |
|---|---|
| GameModeSettingsCreator.Result |
CreateFromDraft(UnityGameModeSettingsDefinition, string, string, bool)
The single write path: resolves-or-creates the settings asset BY ID WITHIN
outputFolderPath and commits every field draft carries onto it
via ResolveAndCommit<TSettings>(TSettings, string, string, string, SerenityAssetCreationTransaction) — serialization decides
what gets written, not a hand-maintained field list, so a field the wizard does not itself draw still
survives an update. On any failure every mutation is rolled back through the transaction's
existing-asset restore, which restores the WHOLE asset — including the per-mode transition-signal
list, touched or not — before a newly created asset is deleted along with its Addressables entry.
draft itself — the caller-owned draft, captured before the Id trim below — is
restored the same way, so a wizard window's own long-lived scratch instance is left exactly as it
was handed in on failure.
Declaration
public static GameModeSettingsCreator.Result CreateFromDraft(UnityGameModeSettingsDefinition draft, string outputFolderPath, string id, bool registerAsAddressables)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityGameModeSettingsDefinition | draft | Every field to write: an already-seeded scratch draft from an existing asset for an update-in-place run, or a freshly populated one for a create. Its own Guid is ignored — identity is owned by ResolveAndCommit<TSettings>(TSettings, string, string, string, SerenityAssetCreationTransaction). |
| string | outputFolderPath | |
| string | id | |
| bool | registerAsAddressables |
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 |