logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    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 Setup Assistant (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 Serenity.Global.Infrastructure.Settings.Editor.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.

    CreateGameModeSettingsWindow only collects input and renders results; every asset mutation lives here.
    Inheritance
    object
    GameModeSettingsCreator
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.GameMode.Installation.Editor.Builder
    Assembly: Serenity.UnityGameMode.Installation.Editor.dll
    Syntax
    public static class GameModeSettingsCreator

    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: a newly created asset is deleted, its Addressables entry removed, an already-existing asset's pre-call field values and touched transition-signal lists are restored, and any per-mode configuration entry this run appended for a mode that had none before is removed outright — a failed run never leaves a stray entry behind.

    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
    In this article
    © 2026 Serenity. All Rights Reserved