class in Unity.Localization
/
Inherits from:Unity.Localization.ResourceEntryBase
Implements interfaces:IResourceEntry, IStringEntry
Represents a localized string entry that stores a single text value with no variants.
This is the built-in IStringEntry kind, holding one locale's text for a key. Add one to a table with
ResourceTable.AddStringEntry, which also registers the key in the shared data,
or construct one for an existing key id and add it with ResourceTable.AddEntry.
Whether the value is treated as a Smart String is a per-key flag on the SharedTableData, not on the
entry.
Additional resources: IStringEntry, ResourceTable, ResourceEntryBase, SharedTableData
<para>Add a string entry to a table and read its value.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class StringEntryOverviewExample { public void Run() { var shared = ScriptableObject.CreateInstance<SharedTableData>(); shared.TableCollectionName = "UI Text";
var table = ScriptableObject.CreateInstance<ResourceTable>(); table.SharedData = shared; table.LocaleIdentifier = new LocaleIdentifier("en");
StringEntry entry = table.AddStringEntry("greeting", "Hello"); Debug.Log(entry.Value); // Hello
entry.Value = "Hi"; Debug.Log(entry.Value); // Hi } } }
| Constructor | Description |
|---|---|
| StringEntry | Creates an empty entry. |