class in Unity.Localization
/
Inherits from:Unity.Localization.AssetEntryBase_1
Implements interfaces:IFileDataEntry, IResourceEntry
Represents a localized asset stored as a path into a Resources folder.
The entry keeps only the Resources path in AssetEntryBase<T0>.Default, and the asset ships
through its Resources folder rather than as a direct reference, so nothing extra is packed with the table. The asset
is resolved on demand with Resources.Load and unloaded by
AssetEntryBase<T0>.ReleaseAsset. Use AssetEntry instead when you want a direct
reference packed with the table.
Additional resources: AssetEntry, AssetEntryBase<T0>, IAssetEntry, ResourceTable
<para>Add a Resources-backed asset entry and confirm it has a path.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class ResourceAssetEntryOverviewExample { 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 ResourceAssetEntry(shared.AddKey("music").Id); entry.Default = "Audio/theme"; // a path under a Resources folder table.AddEntry(entry);
Debug.Log(entry.HasAsset()); // True: a path is set } } }
| Constructor | Description |
|---|---|
| ResourceAssetEntry | Creates an empty entry. |
| Property | Description |
|---|---|
| Default | The stored reference this entry loads its asset from. |
| Method | Description |
|---|---|
| HasValue | Returns whether the given stored reference holds a value. |
| Release | Releases an asset that was loaded from a stored reference. |
| TryLoadSync | Resolves the asset from the given stored reference synchronously, when the kind supports it. |