Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


IAssetEntry

Represents a resource entry whose localized value is an asset that the entry loads and releases itself.
Read time 1 minuteLast updated 7 days ago

Definition

  • Type: Interface
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
public interface IAssetEntry : IResourceEntry

Remarks

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.
Check whether an asset entry has a value assigned.

Examples

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 } }}

Methods

Method

Description

HasAssetReturns whether this entry has an asset assigned.
ReleaseAssetReleases an asset previously returned by a load.

Inheritance