logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class LeaderboardBackendFactory

    Resolves the ILeaderboardStore backend selected by the shared, consumer-agnostic UnityStructuredBackendDefinition asset assigned to UnityLeaderboardSettings.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 StructuredStoreLeaderboardAdapter. Store construction lives in the shared StructuredBackendStores helper, parameterized by this factory's StructuredBackendConsumerProfile; this class keeps only the leaderboard's own dispatch, fallback target, adapter wrap, and table resolution.

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

    A null backend — and every misconfigured, driver-gated, or failed one — falls back to the device's PlayerPrefs key-value store (the leaderboard'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, IReadOnlyDictionary<BoardId, LeaderboardDefinition>, StoreTable, ILogService)

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

    Declaration
    public static ILeaderboardStore Create(UnityStructuredBackendDefinition backendDefinition, IReadOnlyDictionary<BoardId, LeaderboardDefinition> boards, StoreTable table, ILogService logService)
    Parameters
    Type Name Description
    UnityStructuredBackendDefinition backendDefinition

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

    IReadOnlyDictionary<BoardId, LeaderboardDefinition> boards

    Registered leaderboard definitions, keyed by their board identifier.

    StoreTable table

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

    ILogService logService

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

    Returns
    Type Description
    ILeaderboardStore

    The resolved ILeaderboardStore.

    ResolveTable(string)

    Resolves the leaderboard 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