Class PersistenceBackendDefinitionCreator
The Persistence row's Create action: builds a UnityPersistenceBackendDefinition asset — the
exact type UnitySerenityInstaller.PersistenceBackendDefinition consumes at boot — for a chosen
PersistenceBackendDefinitionOption, offered inline in the row rather than through a native
UnityEditor.GenericMenu (unusable headlessly, and blocks the editor's own IMGUI thread).
The created asset is registered Addressable under PERSISTENCE.
Every candidate installer type is named by string and resolved through ReflectionActivationUtils
/ UnityEditor.TypeCache — never by a compile-time typeof(...) — because this editor assembly
cannot (and must not) reference the Persistence installation assemblies, exactly the constraint
InstallTaskAuthoring.InstallerTypeFullName documents for the initialization-pipeline task facade.
Inherited Members
Namespace: Serenity.CreateGame.Infrastructure.Editor.Systems
Assembly: Serenity.UnityCreateGame.Infrastructure.Editor.dll
Syntax
public static class PersistenceBackendDefinitionCreator
Methods
Create(PersistenceBackendDefinitionOption, string, bool)
Creates option's UnityPersistenceBackendDefinition asset
under "<outputRoot>/Persistence/<DisplayName>.asset", with a sanitized default Id,
committed as an Addressable under PERSISTENCE unless
registerAsAddressables is false (test seam). Returns the created
asset's path.
Declaration
public static string Create(PersistenceBackendDefinitionOption option, string outputRoot, bool registerAsAddressables = true)
Parameters
| Type | Name | Description |
|---|---|---|
| PersistenceBackendDefinitionOption | option | |
| string | outputRoot | |
| bool | registerAsAddressables |
Returns
| Type | Description |
|---|---|
| string |
CreateDefinition(PersistenceBackendDefinitionOption, string, bool)
Create(PersistenceBackendDefinitionOption, string, bool)'s reporting shape: the same run, told through the result every other Serenity creation engine returns, so a caller learns WHY nothing was created instead of reading a null path. Create(PersistenceBackendDefinitionOption, string, bool) stays as it was for the row GUI and returns this result's DefinitionAssetPath.
Declaration
public static PersistenceBackendDefinitionCreator.Result CreateDefinition(PersistenceBackendDefinitionOption option, string outputRoot, bool registerAsAddressables = true)
Parameters
| Type | Name | Description |
|---|---|---|
| PersistenceBackendDefinitionOption | option | |
| string | outputRoot | |
| bool | registerAsAddressables |
Returns
| Type | Description |
|---|---|
| PersistenceBackendDefinitionCreator.Result |
DiscoverOptions()
Every backend kind the row can offer: the built-in File and PlayerPrefs installers, plus
any other concrete PersistenceInstaller subclass with a public parameterless constructor — a
project's own generated custom installer (e.g. Service Extension Creator's InfrastructureSubclass
style) included automatically. Ordered by display name (ordinal).
Declaration
public static IReadOnlyList<PersistenceBackendDefinitionOption> DiscoverOptions()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<PersistenceBackendDefinitionOption> |
FindLegacyStructuredBackendAssetPath(string)
Finds a leftover asset from the now-deleted PersistenceBackendCreationMenu — the previous
Create action for this row, which built a UnityStructuredBackendDefinition subtype
(Postgres/MySql/Mongo/Sqlite/Http/LocalFile/PlayerPrefs — a settings shape belonging to a different
subsystem, the per-feature structured-store connection assets) under the exact same
"<outputRoot>/Persistence/" folder Create(PersistenceBackendDefinitionOption, string, bool) still uses, instead of a
UnityPersistenceBackendDefinition. A project that ran that old menu has an asset here
the Settings row's scan (which looks only for UnityPersistenceBackendDefinition) can
never see, so its row reports Missing with no explanation for why Create looks needed when the
reader remembers already creating a backend. Scoped to this one folder — a UnityStructuredBackendDefinition
subtype elsewhere in the project (a Leaderboard/GameSave/Achievements/GameProgress database
connection, an unrelated and legitimate use of the same base type) is never mistaken for this leftover.
Declaration
public static (string AssetPath, string TypeName)? FindLegacyStructuredBackendAssetPath(string outputRoot)
Parameters
| Type | Name | Description |
|---|---|---|
| string | outputRoot |
Returns
| Type | Description |
|---|---|
| (string AssetPath, string TypeName)? | The leftover asset's path and its concrete type's simple name, or null when none exists. |