Class AddressablesAssetLocator
Unity Addressables-based implementation of IAssetLocator for asset loading operations.
Provides synchronous asset loading using Unity's Addressables system with type validation
and exception handling for robust asset retrieval.
Implements
Inherited Members
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 |