logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AudioPlayerSettingsCreator

    Generates (or updates) one UnityAudioPlayerSettings asset — a Serenity audio channel — from validated input, resolved by Id within OutputFolderPath. Mirrors Serenity.Character.Infrastructure.Editor.Builder.CharacterConfigCreator's per-instance shape: static class, Input/Result DTOs, ValidateIdentity/Validate/Create, transaction-based rollback on failure.

    Absorbs the duplicate channel-creation path that used to live on Serenity.SoundMixer.Infrastructure.RelationshipManager.Editor.AudioChannelCreator, which resolved same-Id clashes via UnityEditor.AssetDatabase.GenerateUniqueAssetPath(System.String) — silently producing a second Foo 1.asset instead of editing the channel the author meant. Routing both the Relationship Manager's Create Channel section and any future wizard through ResolveOrCreateByIdInFolder<TSettings>(string, string, string, SerenityAssetCreationTransaction, out bool) means the same Id in the same folder always updates the one asset in place.

    Inheritance
    object
    AudioPlayerSettingsCreator
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.AudioPlayer.Infrastructure.Settings.Editor.Builder
    Assembly: Serenity.UnityAudioPlayer.Infrastructure.Editor.dll
    Syntax
    public static class AudioPlayerSettingsCreator

    Fields

    DefaultOutputFolder

    Folder a new channel's settings asset is created under when the caller names none — the exact folder AudioChannelCreator.DefaultChannelOutputFolder already pointed at, kept as one declaration so the Relationship Manager and any future wizard land in the same place.

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

    MinimumChannels

    Fewest channels a settings asset may declare (public — the wizard window clamps its input to this same bound).

    Declaration
    public const uint MinimumChannels = 1
    Field Value
    Type Description
    uint

    Methods

    Create(Input)

    Validates the request, seeds a THROWAWAY scratch draft from whatever asset Id resolves to (or a brand-new one), applies every field, and commits it through CreateFromDraft(UnityAudioPlayerSettings, Input). This is the headless/test/recipe entry point ONLY — a flat AudioPlayerSettingsCreator.Input shape mapped onto a scratch draft this method builds and disposes itself. CreateAudioPlayerSettingsWindow never calls this: it commits its own LIVE, long-lived draft (see Serenity.Global.Infrastructure.Editor.SerenityWizardByIdAssetBinding<>) directly through CreateFromDraft(UnityAudioPlayerSettings, Input), which is the single write path both callers share.

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

    CreateFromDraft(UnityAudioPlayerSettings, Input)

    The single write path: resolves-or-creates the channel settings asset BY ID WITHIN input's output folder 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: a freshly created asset is deleted and its Addressables entry removed, an already-existing asset that was being edited has its pre-call field values restored, and draft itself is restored to what the caller handed in.

    Declaration
    public static AudioPlayerSettingsCreator.Result CreateFromDraft(UnityAudioPlayerSettings draft, AudioPlayerSettingsCreator.Input input)
    Parameters
    Type Name Description
    UnityAudioPlayerSettings 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).

    AudioPlayerSettingsCreator.Input input
    Returns
    Type Description
    AudioPlayerSettingsCreator.Result

    Validate(Input)

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

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

    ValidateIdentity(Input)

    Identity validation: the Id rules, and — once a folder is chosen — whether a different asset already sits at the exact path this Id would create, so the Identity step blocks and names it before the Summary ever plans that file.

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