logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Namespace Serenity.Global.Infrastructure.Utils

    Classes

    AudioMixerDependencyCache

    Static cache for AudioMixer and AudioMixerGroup assets that keeps Addressables handles alive to prevent Unity from unloading these critical dependencies during the application lifecycle. This solves the issue where AudioMixerGroup references inside ScriptableObjects become "fake-null" when Addressables handles are released.

    UnityAddressableUtils

    Direct API to load ALL from Addressables (no filtering, no caching).
    Prefer the unified API: LoadAllFromAnyBlocking<T>(string).

    Every public entry point is gated by SerenityAssetLoadingModeProvider:

    • In ResourcesOnly mode the methods short-circuit and return an empty list without touching the Addressables API. A one-time verbose log explains the no-op so a caller that genuinely needed Addressables sees the divergence.
    • In Addressables-using modes the behaviour is unchanged; the blocking variant additionally throws NotSupportedException on WebGL because WaitForCompletion cannot be serviced there.

    UnityAssetUtils

    Utility class for Unity asset loading operations including Addressables management, audio clip caching, and asset warm-up functionality with thread-safe operations.

    Every public entry point is gated by SerenityAssetLoadingModeProvider:

    • AddressablesWithResourcesFallback (default) keeps the committed behaviour: Addressables first, Resources fallback.
    • AddressablesOnly skips every Resources fallback path.
    • ResourcesOnly never touches the Addressables API — no LoadAssetAsync, no LoadAssetsAsync, no LoadResourceLocationsAsync, no WaitForCompletion.

    In ResourcesOnly mode the synchronous WebGL guard is moot: no sync Addressables call is reachable. The guard remains on the Addressables-using branches so that any AddressablesOnly / AddressablesWithResourcesFallback caller that hits sync code on WebGL still throws NotSupportedException with an actionable message.

    UnityAudioMixerGroupUtils

    Utility class for AudioMixerGroup operations

    UnityHierarchyUtils

    Helpers for navigating and querying the Unity scene hierarchy

    UnityMainThread

    Unity MonoBehaviour singleton for managing cross-thread operations and main thread dispatching.
    Provides thread-safe methods to execute actions and functions on Unity's main thread from background threads, with automatic bootstrap initialization and concurrent queue-based operation management.

    UnityParserUtils

    Helpers to parse objects to specific Unity types with error handling

    UnityResourceUtils

    Direct API to load ALL from Resources (no filtering, no async, no caching).
    Prefer the unified API: LoadAllFromAnyBlocking<T>(string)

    UnityUiUtils

    Helpers for Unity UI (uGUI) operations

    UnityUserSystemUtils

    Helpers to detect user system platform (desktop, mobile, consoles, web)

    UnityYamlUtils

    Utility class for parsing YAML content

    In this article
    © 2026 Serenity. All Rights Reserved