logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class GameSaveBackendFactory

    Resolves the IGameSaveStore backend selected by the shared, consumer-agnostic UnityStructuredBackendDefinition asset assigned to UnityGameSaveSettings.Backend, dispatching on the asset's concrete type — checking ICustomStructuredBackendDefinition FIRST so a project-defined store wins — then wraps the resolved IStructuredStore once in a StructuredStoreGameSaveAdapter. Store construction lives in the shared StructuredBackendStores helper, parameterized by this factory's StructuredBackendConsumerProfile; this class keeps only game save's own dispatch, fallback target, adapter wrap, and table resolution.

    Inheritance
    object
    GameSaveBackendFactory
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.GameSave.Installation.Installers
    Assembly: Serenity.UnityGameSave.Installation.dll
    Syntax
    public static class GameSaveBackendFactory
    Remarks

    A null backend — and every misconfigured, driver-gated, or failed one — falls back to the device's PlayerPrefs key-value store (game save's zero-config default) with a warning. PlayerPrefs and LocalFile are always installed; Postgres/MySql/Mongo/Sqlite additionally require their respective SERENITY_STRUCTURED_POSTGRES/SERENITY_STRUCTURED_MYSQL/ SERENITY_STRUCTURED_MONGO/SERENITY_STRUCTURED_SQLITE scripting define and driver. This factory never throws, matching the framework's never-throw-in-runtime philosophy.

    Methods

    Create(UnityStructuredBackendDefinition, StoreTable, ILogService)

    Resolves and constructs the configured game-save store, dispatching on the backend asset's concrete type.

    Declaration
    public static IGameSaveStore Create(UnityStructuredBackendDefinition backendDefinition, StoreTable table, ILogService logService)
    Parameters
    Type Name Description
    UnityStructuredBackendDefinition backendDefinition

    The backend selection, or null to use the PlayerPrefs key-value store.

    StoreTable table

    The table or collection saves persist through, from ResolveTable(string).

    ILogService logService

    Logging service used to report an unavailable backend or configuration fallback. May be null.

    Returns
    Type Description
    IGameSaveStore

    The resolved IGameSaveStore.

    ResolveTable(string)

    Resolves the game-save table from the settings-configured name, or the default when blank.

    Declaration
    public static StoreTable ResolveTable(string tableOrCollectionName)
    Parameters
    Type Name Description
    string tableOrCollectionName

    The configured table or collection name, or null/blank for the default.

    Returns
    Type Description
    StoreTable
    In this article
    © 2026 Serenity. All Rights Reserved