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
StructuredBackendAuthoringFactory
Assembly: Serenity.UnityStructuredPersistence.Infrastructure.Editor.dll
Syntax
public static class StructuredBackendAuthoringFactory
Fields
DatabaseKinds
Declaration
public static readonly StructuredBackendAuthoringKind[] DatabaseKinds
Field Value
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
Returns
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
Returns
IsDatabaseKind(StructuredBackendAuthoringKind)
Declaration
public static bool IsDatabaseKind(StructuredBackendAuthoringKind kind)
Parameters
Returns
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
Returns
ValidateBackendFields(StructuredBackendAuthoringKind, StructuredBackendAuthoringFields, SerenityCreationValidationResult)
Validates fields for kind, reporting into result.
Declaration
public static void ValidateBackendFields(StructuredBackendAuthoringKind kind, StructuredBackendAuthoringFields fields, SerenityCreationValidationResult result)
Parameters
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
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