An optional capability for an asset provider that loads assets asynchronously.
Implement this alongside IAssetProvider when a provider loads through an asynchronous operation, such as
a Resources request or Addressables. The localization system calls this on the asynchronous resolve paths. A provider
that can also resolve immediately implements ISynchronousAssetProvider as well; one that can only resolve
immediately implements just the synchronous capability, and the asynchronous paths wrap its result in a completed
Awaitable.
Additional resources: IAssetProvider, ISynchronousAssetProvider
<para>A provider that resolves its assets through an asynchronous operation.</para>
using System.Threading; using Unity.Localization.Providers; using UnityEngine; using Object = UnityEngine.Object;
namespace Unity.Localization.Samples { public class IAsyncAssetProviderExample : IAsyncAssetProvider { public async Awaitable<T> LoadAssetAsync<T>(AssetKey key, CancellationToken cancellationToken) where T : Object { await Awaitable.NextFrameAsync(cancellationToken); return null; }
public void Release(Object asset) { } } }
| Method | Description |
|---|---|
| LoadAssetAsync | Loads the asset identified by the key as the requested type. |