logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class StructuredBackendAuthoringFactory

    Engine-side (non-IMGUI) half of the shared backend authoring step: per-kind connection defaults, validation, and shared backend asset construction. Extracted from Serenity.Leaderboard.Infrastructure.Editor.Builder.LeaderboardCreator so the GameSave and GameProgress creation wizards do not each duplicate this logic a second and third time; Leaderboard's own copy is left untouched to avoid touching its already-tested code.

    Inheritance
    object
    StructuredBackendAuthoringFactory
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.StructuredPersistence.Infrastructure.Editor.Authoring
    Assembly: Serenity.UnityStructuredPersistence.Infrastructure.Editor.dll
    Syntax
    public static class StructuredBackendAuthoringFactory

    Fields

    DatabaseKinds

    Declaration
    public static readonly StructuredBackendAuthoringKind[] DatabaseKinds
    Field Value
    Type Description
    StructuredBackendAuthoringKind[]

    Methods

    BuildBackendAsset(StructuredBackendAuthoringKind, StructuredBackendAuthoringFields, string, string)

    Instantiates the shared, consumer-agnostic backend asset for the chosen authoring kind and fills only the fields that subtype actually carries. Every kind produces an explicit asset — including PlayerPrefs, whose definition is field-less — because the runtime selects the store by the asset's concrete type.

    Declaration
    public static UnityStructuredBackendDefinition BuildBackendAsset(StructuredBackendAuthoringKind kind, StructuredBackendAuthoringFields fields, string defaultLocalFileDirectoryName, string defaultSqliteDatabaseFileName)
    Parameters
    Type Name Description
    StructuredBackendAuthoringKind kind
    StructuredBackendAuthoringFields fields
    string defaultLocalFileDirectoryName
    string defaultSqliteDatabaseFileName
    Returns
    Type Description
    UnityStructuredBackendDefinition

    GetKindDefaults(StructuredBackendAuthoringKind, string)

    Connection defaults for a given backend kind. Non-server kinds report Port 0 and the shared Database name since none of them use a server connection. Sqlite reports TimeoutSeconds 0 because the shared UnitySqliteBackendDefinition carries no timeout knob — the driver default applies.

    Declaration
    public static StructuredBackendAuthoringFactory.KindDefaults GetKindDefaults(StructuredBackendAuthoringKind kind, string defaultSqliteDatabaseFileName)
    Parameters
    Type Name Description
    StructuredBackendAuthoringKind kind
    string defaultSqliteDatabaseFileName
    Returns
    Type Description
    StructuredBackendAuthoringFactory.KindDefaults

    IsDatabaseKind(StructuredBackendAuthoringKind)

    Declaration
    public static bool IsDatabaseKind(StructuredBackendAuthoringKind kind)
    Parameters
    Type Name Description
    StructuredBackendAuthoringKind kind
    Returns
    Type Description
    bool

    ScriptingDefineFor(StructuredBackendAuthoringKind)

    The scripting define a database kind's driver requires, or empty for a non-database kind.

    Declaration
    public static string ScriptingDefineFor(StructuredBackendAuthoringKind kind)
    Parameters
    Type Name Description
    StructuredBackendAuthoringKind kind
    Returns
    Type Description
    string

    ValidateBackendFields(StructuredBackendAuthoringKind, StructuredBackendAuthoringFields, SerenityCreationValidationResult)

    Validates fields for kind, reporting into result.

    Declaration
    public static void ValidateBackendFields(StructuredBackendAuthoringKind kind, StructuredBackendAuthoringFields fields, SerenityCreationValidationResult result)
    Parameters
    Type Name Description
    StructuredBackendAuthoringKind kind
    StructuredBackendAuthoringFields fields
    SerenityCreationValidationResult result

    ValidateBackendPathCollision(UnityStructuredBackendDefinition, string, SerenityCreationValidationResult)

    Blocks a genuine backend-path collision — something unrelated already occupies the planned file path — but never the settings asset's OWN already-assigned backend sitting at that same path. The rule is identity, not nullness or a Replace Existing Backend flag: the file at plannedBackendPath is safe only when it IS existingBackend's own asset — resolved via UnityEditor.AssetDatabase.GetAssetPath(UnityEngine.Object). A caller's Backend Folder / Backend Asset Name fields can point the planned path anywhere regardless of where the assigned backend actually lives, so this check never takes a Replace flag as an input: any other existing file at the planned path blocks unconditionally, because Replace Existing Backend may only ever replace the ASSIGNED backend, at its own path, never a stranger's file that merely happens to share the planned path.

    Declaration
    public static void ValidateBackendPathCollision(UnityStructuredBackendDefinition existingBackend, string plannedBackendPath, SerenityCreationValidationResult result)
    Parameters
    Type Name Description
    UnityStructuredBackendDefinition existingBackend
    string plannedBackendPath
    SerenityCreationValidationResult result

    ValidateReplaceDoesNotRelocateTheAssignedBackend(UnityStructuredBackendDefinition, string, bool, SerenityCreationValidationResult)

    A Replace Existing Backend run may only ever replace the ASSIGNED backend at its own path — never move it. While a backend is assigned and this run means to replace it, a planned path that is not that backend's own path blocks: the Backend Folder / Backend Asset Name fields describe where a FRESH backend would be created, and a Replace run silently building a second backend at that path while leaving the original still on disk and still Addressables-registered is exactly the orphan this guards against. A no-op when nothing is assigned yet (there is nothing to relocate) or the run is not replacing (a fresh backend at any path is fine).

    Declaration
    public static void ValidateReplaceDoesNotRelocateTheAssignedBackend(UnityStructuredBackendDefinition existingBackend, string plannedBackendPath, bool replaceExistingBackend, SerenityCreationValidationResult result)
    Parameters
    Type Name Description
    UnityStructuredBackendDefinition existingBackend
    string plannedBackendPath
    bool replaceExistingBackend
    SerenityCreationValidationResult result
    In this article
    © 2026 Serenity. All Rights Reserved