| Parameter | Description |
|---|---|
| key | The asset to resolve. |
| asset | The resolved asset, or null on a miss. |
bool
true when the asset resolved; otherwise false.
Resolves the referenced asset for the key without an asynchronous load.
Returns true and the asset when the address is registered and the asset is a
T (or matches AssetKey.Type when T is the base
Object); otherwise returns false with a null asset.
Because the assets are already in memory, this provider only implements the synchronous capability.
<para>Register a texture by address and resolve it back through the provider.</para>
using Unity.Localization.Providers; using UnityEngine;
namespace Unity.Localization.Samples { public class ReferencedAssetProviderLoadAssetGenericExample { public void Run() { var provider = new ReferencedAssetProvider(); provider.Add("UI/Logo", new Texture2D(2, 2));
if (provider.TryLoadAsset<Texture2D>(new AssetKey("UI/Logo", typeof(Texture2D)), out var logo)) Debug.Log(logo.name); } } }