| Parameter | Description |
|---|---|
| key | The key to look up. |
long
The key's stable id, or 0 when it is absent.
Returns the stable id for a key.
Returns 0 when the key is empty, null, or not present. Ids are stable across renames, so store the id rather
than the key text when you need a reference that survives a rename.
Additional resources: SharedTableData.GetKey, SharedTableData.GetEntry
<para>Look up the id assigned to a key.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class SharedTableDataGetIdExample { public void Run() { var sharedData = ScriptableObject.CreateInstance<SharedTableData>(); sharedData.AddKey("GREETING");
long id = sharedData.GetId("GREETING"); // the key's stable id long missing = sharedData.GetId("UNKNOWN"); // 0
Debug.Log(id != 0); // True Debug.Log(missing); // 0 } } }