Represents a resource entry whose localized value is an asset that the entry loads and releases itself.
Each concrete kind owns how its asset is referenced and resolved: AssetEntry keeps a direct object
reference, ResourceAssetEntry stores a Resources path, and a package can add other kinds such
as an Addressables-backed entry. An entry opts into loading by implementing IAsyncAssetEntry,
ISynchronousAssetEntry, or both; the localization system prefers the asynchronous version and falls
back to the synchronous one. Every loaded asset should be handed back with
IAssetEntry.ReleaseAsset so the owning kind can free it. Fetch an asset entry from a table
with ResourceTable.GetEntry using IAssetEntry as the type argument.
Additional resources: AssetEntry, ResourceAssetEntry, AssetEntryBase<T0>, IAsyncAssetEntry, ISynchronousAssetEntry
<para>Check whether an asset entry has a value assigned.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class IAssetEntryOverviewExample { public void Run() { var shared = ScriptableObject.CreateInstance<SharedTableData>(); shared.TableCollectionName = "UI Assets";
var table = ScriptableObject.CreateInstance<ResourceTable>(); table.SharedData = shared; table.LocaleIdentifier = new LocaleIdentifier("en");
table.AddEntry(new AssetEntry(shared.AddKey("icon").Id)); IAssetEntry entry = table.GetEntry<IAssetEntry>("icon");
Debug.Log(entry.HasAsset()); // False: no asset assigned yet } } }
| Method | Description |
|---|---|
| HasAsset | Returns whether this entry has an asset assigned. |
| ReleaseAsset | Releases an asset previously returned by a load. |