AddEntry(IResourceEntry)
Adds an entry, replacing any existing entry with the same key id.
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Method
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
public void AddEntry(IResourceEntry entry)
Parameters
The entry to add.
Remarks
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 entry, or one whose key id is , is ignored. To add a plain string without constructing the entry yourself, use ResourceTable.AddStringEntry.
null0Add a shared key, then store a string entry for it in this locale.
Examples
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 } }}