logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AchievementSettingsCreator

    Generates (or updates) a project's achievements configuration from a single description: the UnityAchievementSettings asset, its structured backend, one platform definition per storefront the project ships on, and optionally the UnityAchievementsViewDefinition that lists the achievements on screen. Mirrors Serenity.GameSave.Infrastructure.Editor.Builder.GameSaveCreator: static class, Input/Result DTOs, ValidateIdentity(Input)/Validate(Input), and a Create(Input, Action) whose every mutation is rolled back on failure.

    Inheritance
    object
    AchievementSettingsCreator
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Achievements.Infrastructure.Editor.Builder
    Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
    Syntax
    public static class AchievementSettingsCreator
    Remarks

    The wizard window that collects this input ships separately and hosts it at Tools ▸ Serenity ▸ Create ▸ Achievements ▸ Create Achievements (priority 247, per Assets/Documentation/MENU_ORDERING.md). Every asset mutation lives here, so the window stays pure presentation and the whole flow is testable without IMGUI. Four collaborators carry the rest: AchievementSettingsValidator owns the rules, AchievementAuthoringPaths owns where each asset lands, AchievementPlatformAssetAuthoring writes the storefront assets, and AchievementModuleWiring connects the result to the rest of the project.

    An occupied asset path is always an error, never an overwrite or a silent rename. That holds for the backend (assign ExistingBackend to reuse one, or pick a free BackendAssetName), for the view definition, and for the platform definitions. The one deliberate difference from GameSaveCreator is that this creator has no same-path move-aside replace: ReplaceExistingBackend governs only whether a settings asset's ALREADY ASSIGNED backend reference is overwritten.

    Fields

    DefaultLocalFileDirectoryName

    Folder name a Local File backend writes under, and the value the wizard shows as its default.

    Declaration
    public const string DefaultLocalFileDirectoryName = "achievements"
    Field Value
    Type Description
    string

    DefaultSettingsAssetName

    Default file name (without extension) of the settings asset.

    Declaration
    public const string DefaultSettingsAssetName = "AchievementSettings"
    Field Value
    Type Description
    string

    DefaultSqliteDatabaseFileName

    File name an embedded SQLite backend uses, and the value the wizard shows as its default.

    Declaration
    public const string DefaultSqliteDatabaseFileName = "achievements.db"
    Field Value
    Type Description
    string

    Methods

    Create(Input, Action)

    Validates the request, writes the achievements assets, then connects them to the rest of the project.

    Declaration
    public static AchievementSettingsCreator.Result Create(AchievementSettingsCreator.Input input, Action afterOptionsApplied = null)
    Parameters
    Type Name Description
    AchievementSettingsCreator.Input input

    What to author.

    Action afterOptionsApplied

    A seam for a test that needs the run to fail at one exact instant, null in production. It is invoked once every asset write AND ApplyTo(UnityAchievementSettings) have run but before the transaction commits — the only moment where the settings asset is dirty in every way this creator can make it (backend reference, platform references and option values), which is the state a rollback has to undo in full and no black-box failure can reach: this creator's last asset step, the view, writes BEFORE the options are applied.

    Returns
    Type Description
    AchievementSettingsCreator.Result

    The outcome, never null; check Serenity.Global.Infrastructure.Editor.SerenityCreationResult.Success.

    Remarks

    The two phases are deliberately not in one try/catch. Everything Serenity.Achievements.Infrastructure.Editor.Builder.AchievementSettingsCreator.TryWriteAssets(Serenity.Achievements.Infrastructure.Editor.Builder.AchievementSettingsCreator.Input,Serenity.Achievements.Infrastructure.Editor.Builder.AchievementSettingsCreator.Result,System.Action) touches belongs to this run, so any failure there rolls the project back to exactly where it started. What Serenity.Achievements.Infrastructure.Editor.Builder.AchievementSettingsCreator.RunProjectWideWiring(Serenity.Achievements.Infrastructure.Editor.Builder.AchievementSettingsCreator.Input,Serenity.Achievements.Infrastructure.Editor.Builder.AchievementSettingsCreator.Result) touches does not — see AchievementModuleWiring — so it runs only once the assets are safely committed, catches its own failures, and can no longer trigger a rollback of work that already succeeded.

    Validate(Input)

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

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

    What would be authored.

    Returns
    Type Description
    SerenityCreationValidationResult

    The findings; see AchievementSettingsValidator for the rules.

    ValidateIdentity(Input)

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

    Declaration
    public static SerenityCreationValidationResult ValidateIdentity(AchievementSettingsCreator.Input input)
    Parameters
    Type Name Description
    AchievementSettingsCreator.Input input

    What would be authored.

    Returns
    Type Description
    SerenityCreationValidationResult

    The findings; see AchievementSettingsValidator for the rules.

    In this article
    © 2026 Serenity. All Rights Reserved