| Parameter | Description |
|---|---|
| entry | The entry to add. |
Adds an entry, replacing any existing entry with the same key id.
The entry must already carry a non-zero key id, so build it against a key that exists in
ResourceTable.SharedData, for example one returned by SharedTableData.AddKey. A
null entry, or one whose key id is 0, is ignored. To add a plain string without
constructing the entry yourself, use ResourceTable.AddStringEntry.
Additional resources: ResourceTable.AddStringEntry, ResourceTable.RemoveEntry, SharedTableData
<para>Add a shared key, then store a string entry for it in this locale.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class ResourceTableAddEntryExample { public void Run() { var shared = ScriptableObject.CreateInstance<SharedTableData>(); var table = ScriptableObject.CreateInstance<ResourceTable>(); table.SharedData = shared; table.LocaleIdentifier = "en";
var key = shared.AddKey("Title"); table.AddEntry(new StringEntry(key.Id, "Menu"));
Debug.Log(table.GetEntry<IStringEntry>("Title").Value); // Menu } } }