logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AddressablesAssetLocator

    Unity Addressables-based implementation of IAssetLocator.

    Gated by SerenityAssetLoadingModeProvider:

    • In ResourcesOnly mode every call returns false without touching the Addressables API, so consumers degrade gracefully and the WebGL WaitForCompletion trap is never reached. A future ResourcesAssetLocator can be registered alongside / instead of this one if a Resources-backed lookup is needed; this slice does not introduce one to avoid overbuild.
    • In any Addressables-using mode the behaviour is unchanged on every non-WebGL platform. On WebGL the synchronous WaitForCompletion path throws NotSupportedException to flag the genuinely unsafe call site instead of silently hanging.
    Inheritance
    object
    AddressablesAssetLocator
    Implements
    IAssetLocator
    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.Services
    Assembly: Serenity.UnityGlobal.Infrastructure.dll
    Syntax
    public class AddressablesAssetLocator : IAssetLocator

    Constructors

    AddressablesAssetLocator()

    Declaration
    public AddressablesAssetLocator()

    Methods

    TryLoad(string, Type, out object)

    Attempts to load an asset by key and validates its type.
    Uses Unity Addressables system for asset loading with synchronous completion.

    Declaration
    public bool TryLoad(string key, Type type, out object obj)
    Parameters
    Type Name Description
    string key

    Addressable key of the asset to load

    Type type

    Expected type of the asset (null for no type validation)

    object obj

    When successful, contains the loaded asset; otherwise, null

    Returns
    Type Description
    bool

    True if the asset was loaded successfully and matches the expected type; otherwise, false

    Implements

    IAssetLocator
    In this article
    © 2026 Serenity. All Rights Reserved