logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class MenuServiceSettingsCreator

    Generates (or updates) the project-wide UnityMenuServiceSettingsDefinition asset from a single description. Runs on SingletonSettingsCreationEngine<TSettings, TInput, TResult>: this class stays the caller-facing static surface — Input/Result DTOs, ValidateIdentity/Validate/Create, ResolveSettingsContext<TSettings>(string, string) for "edit existing" detection — and forwards every member to one MenuServiceSettingsCreator.Engine instance that supplies the module's own fields. CreateMenuServiceSettingsWindow only collects input and renders results; every asset mutation lives in the engine.

    Inheritance
    object
    MenuServiceSettingsCreator
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Menu.Infrastructure.Editor.Builder
    Assembly: Serenity.UnityMenu.Infrastructure.Editor.dll
    Syntax
    public static class MenuServiceSettingsCreator

    Fields

    DefaultAssetName

    File name (without extension) for a brand-new settings asset when the caller names none.

    Declaration
    public const string DefaultAssetName = "MenuServiceSettings"
    Field Value
    Type Description
    string

    DefaultBorderMargin

    These two defaults — through DefaultBorderMargin — mirror the exact values on the package's own shipped reference asset, Assets/Serenity/Media/Menu/MenuServiceSettings.asset, because UnityMenuServiceSettingsDefinition declares no field initializers of its own (a bare Assets ▸ Create asset is all zeros/empty). MenuServiceSettingsCreator.Input's field initializers and the wizard window's serialized field initializers both reference these constants instead of repeating the values, so a retune of the shipped asset only ever needs to change one place.

    Declaration
    public static readonly Vector2 DefaultBorderMargin
    Field Value
    Type Description
    Vector2

    DefaultControllerId

    These two defaults — through DefaultBorderMargin — mirror the exact values on the package's own shipped reference asset, Assets/Serenity/Media/Menu/MenuServiceSettings.asset, because UnityMenuServiceSettingsDefinition declares no field initializers of its own (a bare Assets ▸ Create asset is all zeros/empty). MenuServiceSettingsCreator.Input's field initializers and the wizard window's serialized field initializers both reference these constants instead of repeating the values, so a retune of the shipped asset only ever needs to change one place.

    Declaration
    public const string DefaultControllerId = "MenuController"
    Field Value
    Type Description
    string

    DefaultId

    Identifier written onto a brand-new settings asset when the caller names none.

    Declaration
    public const string DefaultId = "menuService"
    Field Value
    Type Description
    string

    DefaultOutputFolder

    Default output folder for a brand-new settings asset — under the game's content root, matching every other singleton settings creator (ScoreSettingsCreator, SoundMixerSettingsCreator).

    Declaration
    public const string DefaultOutputFolder = "Assets/Game/Media/Menu"
    Field Value
    Type Description
    string

    Methods

    Create(Input)

    Validates the request, then either updates the existing asset named by Input.ExistingSettingsAssetPath or creates a brand-new one. On any failure during creation every mutation is rolled back so the project is left untouched.

    Declaration
    public static MenuServiceSettingsCreator.Result Create(MenuServiceSettingsCreator.Input input)
    Parameters
    Type Name Description
    MenuServiceSettingsCreator.Input input
    Returns
    Type Description
    MenuServiceSettingsCreator.Result

    CreateFromDraft(UnityMenuServiceSettingsDefinition, string, string, bool)

    Draft-based counterpart of Create(Input): commits every field draft carries via the shared CreateFromDraft(TSettings, string, string, bool) path, so CreateMenuServiceSettingsWindow's SerenityWizardDraftLifecycle-seeded draft round-trips every field UnityMenuServiceSettingsDefinition owns instead of only the two this class's own MenuServiceSettingsCreator.Input carries.

    Declaration
    public static MenuServiceSettingsCreator.Result CreateFromDraft(UnityMenuServiceSettingsDefinition draft, string explicitSettingsAssetPath, string newSettingsFolderPath, bool registerAsAddressables)
    Parameters
    Type Name Description
    UnityMenuServiceSettingsDefinition draft
    string explicitSettingsAssetPath
    string newSettingsFolderPath
    bool registerAsAddressables
    Returns
    Type Description
    MenuServiceSettingsCreator.Result

    CreateNewWithin(Input, SerenityAssetCreationTransaction)

    The part of a creation run that happens inside a transaction: ensures the output folder, creates the asset and verifies it landed on disk, without committing or rolling back anything itself. Exposed so MenuCreator can fold the settings singleton's creation into its OWN transaction alongside the menu drafts, instead of this class committing (or rolling back) a separate transaction first.

    Declaration
    public static string CreateNewWithin(MenuServiceSettingsCreator.Input input, SerenityAssetCreationTransaction transaction)
    Parameters
    Type Name Description
    MenuServiceSettingsCreator.Input input
    SerenityAssetCreationTransaction transaction
    Returns
    Type Description
    string

    The path the asset was created at.

    ResolveSettingsContext(string, string)

    Thin wrapper over the shared ResolveSettingsContext<TSettings>(string, string), exposed so the window can auto-detect the project-wide singleton for its "Edit existing" field, and so MenuCreator can resolve its own get-or-create target scoped to a single folder (a test's temp folder, or the caller's configured Input.OutputFolderPath) instead of the whole project.

    Declaration
    public static SettingsAssetAuthoring.SettingsResolution<UnityMenuServiceSettingsDefinition> ResolveSettingsContext(string explicitSettingsAssetPath = "", string searchRootFolder = null)
    Parameters
    Type Name Description
    string explicitSettingsAssetPath
    string searchRootFolder
    Returns
    Type Description
    SettingsResolution<UnityMenuServiceSettingsDefinition>

    UpdateExistingInPlace(Input)

    Updates the already-validated existing asset named by Input.ExistingSettingsAssetPath in place. Exposed so MenuCreator can update the singleton it resolved on its own, without paying for a second Validate(Input) pass over an input it already validated itself.

    Declaration
    public static MenuServiceSettingsCreator.Result UpdateExistingInPlace(MenuServiceSettingsCreator.Input input)
    Parameters
    Type Name Description
    MenuServiceSettingsCreator.Input input
    Returns
    Type Description
    MenuServiceSettingsCreator.Result

    Validate(Input)

    Full validation, re-checked at creation time so Create(Input) is safe to call independently of the window's live validation.

    Declaration
    public static SerenityCreationValidationResult Validate(MenuServiceSettingsCreator.Input input)
    Parameters
    Type Name Description
    MenuServiceSettingsCreator.Input input
    Returns
    Type Description
    SerenityCreationValidationResult

    ValidateIdentity(Input)

    Id-only validation, usable before a folder choice has been made.

    Declaration
    public static SerenityCreationValidationResult ValidateIdentity(MenuServiceSettingsCreator.Input input)
    Parameters
    Type Name Description
    MenuServiceSettingsCreator.Input input
    Returns
    Type Description
    SerenityCreationValidationResult
    In this article
    © 2026 Serenity. All Rights Reserved