AssetEntry
Represents a localized asset stored as a direct object reference that ships and loads with the table.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Class
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
- Inherits from: AssetEntryBase<Object>
- Implements: IAssetEntry, IResourceEntry, ISynchronousAssetEntry
public class AssetEntry : AssetEntryBase<Object>, IAssetEntry, IResourceEntry, ISynchronousAssetEntry
Remarks
The asset is referenced directly through AssetEntry.DirectAsset, so it is included in the build and resolves without an asynchronous load. Use this kind for assets you want packed with the table, and use ResourceAssetEntry when the asset ships through a folder instead. Add one to a table with ResourceTable.AddEntry.
ResourcesAdd a direct asset entry to a table and check its state.
Examples
using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class AssetEntryOverviewExample { 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"); var entry = new AssetEntry(shared.AddKey("icon").Id); table.AddEntry(entry); Debug.Log(entry.HasAsset()); // False until DirectAsset is assigned Debug.Log(entry.DirectAsset); // null } }}
Constructors
Constructor | Description |
|---|---|
| AssetEntry() | Creates an empty entry. |
| AssetEntry(System.Int64) | Creates an entry for a key id. |
Properties
Property | Description |
|---|---|
| DirectAsset | The directly referenced asset for this entry. |