Class AddressablesAssetLocator
Unity Addressables-based implementation of IAssetLocator.
Gated by SerenityAssetLoadingModeProvider:
- In
ResourcesOnlymode every call returnsfalsewithout touching the Addressables API, so consumers degrade gracefully and the WebGLWaitForCompletiontrap is never reached. A futureResourcesAssetLocatorcan 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
WaitForCompletionpath throws NotSupportedException to flag the genuinely unsafe call site instead of silently hanging.
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 |