logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnitySingletonSettingsLoader

    Loads the single settings asset an installer needs for a module label, applying the project-ownership rule: a project-owned settings asset beats a shipped one with the same Id (SingletonSettingsSelection). Replaces the historical candidates.Length > 0 ? candidates[0] : null idiom, which picked whichever asset Addressables/Resources happened to enumerate first.

    In SerenityAssetLoadingMode.ResourcesOnly, LoadAllFromAnyBlocking<T>(string) ignores labels entirely (Resources.LoadAll has no label concept) and returns every asset of type T under a Resources/ folder. Since Serenity never ships its own settings under Assets/Serenity/Resources (see the "AutoLoad" warning on LoadAllFromAnyBlocking<T>(string)), every candidate found this way is project content by construction, so the module-label query and the PROJECT_OWNED query return the same set and ownership resolves correctly with no special-casing.

    Inheritance
    object
    UnitySingletonSettingsLoader
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Global.Infrastructure.Utils
    Assembly: Serenity.UnityGlobal.Infrastructure.dll
    Syntax
    public static class UnitySingletonSettingsLoader

    Methods

    LoadBlocking<T>(IEnumerable<string>, ILogService)

    Loads every candidate settings asset of type T for moduleLabels, then picks the project-owned one when present, falling back to a shipped one otherwise. Returns null when no candidate exists at all — the caller keeps its own "not found" warning or exception, unchanged.

    Declaration
    public static T LoadBlocking<T>(IEnumerable<string> moduleLabels, ILogService logService) where T : Object, IFoundationSettings
    Parameters
    Type Name Description
    IEnumerable<string> moduleLabels
    ILogService logService
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    LoadBlocking<T>(string, ILogService)

    Loads the single settings asset for one module label. See the multi-label overload.

    Declaration
    public static T LoadBlocking<T>(string moduleLabel, ILogService logService) where T : Object, IFoundationSettings
    Parameters
    Type Name Description
    string moduleLabel
    ILogService logService
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    ReportSelection<T>(SingletonSelectionResult<T>, ILogService)

    Says which asset the game is about to run on and names every asset of the same type it is shadowing. A loader that reports only "there were several" leaves an author reading a settings asset the game never opens, so each loser is named alongside the winner and the repair.

    Declaration
    public static void ReportSelection<T>(SingletonSelectionResult<T> selection, ILogService logService) where T : Object, IFoundationSettings
    Parameters
    Type Name Description
    SingletonSelectionResult<T> selection
    ILogService logService
    Type Parameters
    Name Description
    T

    SelectBlocking<T>(IEnumerable<string>)

    The selection LoadBlocking<T>(IEnumerable<string>, ILogService) makes, without reporting it — for the one caller that has no log to report through until the settings it is loading have built one: a log sink. It reports through ReportSelection<T>(SingletonSelectionResult<T>, ILogService) once its own service exists. Picked is null when no candidate exists at all.

    Declaration
    public static SingletonSelectionResult<T> SelectBlocking<T>(IEnumerable<string> moduleLabels) where T : Object, IFoundationSettings
    Parameters
    Type Name Description
    IEnumerable<string> moduleLabels
    Returns
    Type Description
    SingletonSelectionResult<T>
    Type Parameters
    Name Description
    T

    SelectBlocking<T>(string)

    The selection for one module label. See the multi-label overload.

    Declaration
    public static SingletonSelectionResult<T> SelectBlocking<T>(string moduleLabel) where T : Object, IFoundationSettings
    Parameters
    Type Name Description
    string moduleLabel
    Returns
    Type Description
    SingletonSelectionResult<T>
    Type Parameters
    Name Description
    T
    In this article
    © 2026 Serenity. All Rights Reserved