# GetId(string)

> Returns the stable id for a key.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Localization](/engine/6000.7/script-reference/unity/localization.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule

```csharp
public long GetId(string key)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The key to look up.

### Returns

| Type                                                        | Description                                    |
| ----------------------------------------------------------- | ---------------------------------------------- |
| [long](https://learn.microsoft.com/dotnet/api/system.int64) | The key's stable id, or `0` when it is absent. |

### Remarks

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](/engine/6000.7/script-reference/unity/localization/sharedtabledata/getkey.md), [SharedTableData.GetEntry](/engine/6000.7/script-reference/unity/localization/sharedtabledata/getentry.md)

Look up the id assigned to a key.

### Examples

```csharp
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
        }
    }
}
```
