# ResourceTable

> A localization table that holds the translated values for one locale in a collection.

## Definition

* **Type:** Class
* **Namespace:** [Unity.Localization](/engine/6000.7/script-reference/unity/localization.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule
* **Inherits from:** [ScriptableObject](/engine/6000.7/script-reference/unityengine/scriptableobject.md)
* **Implements:** [ISerializationCallbackReceiver](/engine/6000.7/script-reference/unityengine/iserializationcallbackreceiver.md)

```csharp
[HelpURL("localization/localization-tables")]
public sealed class ResourceTable : ScriptableObject, ISerializationCallbackReceiver
```

## Remarks

Each table targets a single locale (reported by [ResourceTable.LocaleIdentifier](/engine/6000.7/script-reference/unity/localization/resourcetable/localeidentifier.md)) and shares its keys with every other locale table in the collection through one [SharedTableData](/engine/6000.7/script-reference/unity/localization/sharedtabledata.md). Values are stored as polymorphic [IResourceEntry](/engine/6000.7/script-reference/unity/localization/iresourceentry.md) objects (strings, assets, variants, or custom kinds) held through `[SerializeReference]`, so a single table type covers every entry kind. Look entries up by stable key id or by key text with the [ResourceTable.GetEntry](/engine/6000.7/script-reference/unity/localization/resourcetable/getentry.md) family, add plain strings with [ResourceTable.AddStringEntry](/engine/6000.7/script-reference/unity/localization/resourcetable/addstringentry.md), and add fully-formed entries with [ResourceTable.AddEntry](/engine/6000.7/script-reference/unity/localization/resourcetable/addentry.md). Tables belong to a collection: create one through the Resource Tables window, or with the ScriptableObject.CreateInstance method, assigning [ResourceTable.SharedData](/engine/6000.7/script-reference/unity/localization/resourcetable/shareddata.md) before resolving keys by text.

Additional Resources: [SharedTableData](/engine/6000.7/script-reference/unity/localization/sharedtabledata.md), [IResourceEntry](/engine/6000.7/script-reference/unity/localization/iresourceentry.md), [IStringEntry](/engine/6000.7/script-reference/unity/localization/istringentry.md), [LocaleIdentifier](/engine/6000.7/script-reference/unity/localization/localeidentifier.md)

Create a table, add a string, and read it back.

## Examples

```csharp
using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples
{
    public class ResourceTableOverviewExample
    {
        public void Run()
        {
            var shared = ScriptableObject.CreateInstance<SharedTableData>();
            var table = ScriptableObject.CreateInstance<ResourceTable>();
            table.SharedData = shared;
            table.LocaleIdentifier = "en";

            table.AddStringEntry("Greeting", "Hello");

            var entry = table.GetEntry<IStringEntry>("Greeting");
            Debug.Log(entry.Value); // Hello
        }
    }
}
```

## Properties

| Property                                                                                                       | Description                                                   |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [Entries](/engine/6000.7/script-reference/unity/localization/resourcetable/entries.md)                         | The entries this table holds for its locale.                  |
| [LocaleIdentifier](/engine/6000.7/script-reference/unity/localization/resourcetable/localeidentifier.md)       | The locale this table provides values for.                    |
| [Metadata](/engine/6000.7/script-reference/unity/localization/resourcetable/metadata.md)                       | The metadata attached to this table for its locale.           |
| [SharedData](/engine/6000.7/script-reference/unity/localization/resourcetable/shareddata.md)                   | The shared key data for the collection this table belongs to. |
| [TableCollectionName](/engine/6000.7/script-reference/unity/localization/resourcetable/tablecollectionname.md) | The name of the collection this table belongs to.             |

## Methods

| Method                                                                                                   | Description                                                       |
| -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [AddEntry](/engine/6000.7/script-reference/unity/localization/resourcetable/addentry.md)                 | Adds an entry, replacing any existing entry with the same key id. |
| [AddStringEntry](/engine/6000.7/script-reference/unity/localization/resourcetable/addstringentry.md)     | Adds or updates a plain string entry for a key.                   |
| [AddStringVariant](/engine/6000.7/script-reference/unity/localization/resourcetable/addstringvariant.md) | Adds or updates a variant value for a string key in this table.   |
| [GetEntry](/engine/6000.7/script-reference/unity/localization/resourcetable/getentry.md)                 | Returns the entry stored for a stable key id.                     |
| [RemoveAllEntries](/engine/6000.7/script-reference/unity/localization/resourcetable/removeallentries.md) | Removes every entry from this table.                              |
| [RemoveEntry](/engine/6000.7/script-reference/unity/localization/resourcetable/removeentry.md)           | Removes the entry for a stable key id from this table.            |
| [RemoveVariant](/engine/6000.7/script-reference/unity/localization/resourcetable/removevariant.md)       | Removes one variant value from a key's entry in this table.       |

## Inheritance

**Inherited Members:**

* [ScriptableObject.CreateInstance(string)](/engine/6000.7/script-reference/unityengine/scriptableobject/createinstance.md#createinstance\(string\))
* [ScriptableObject.CreateInstance(Type)](/engine/6000.7/script-reference/unityengine/scriptableobject/createinstance.md#createinstance\(type\))
* [ScriptableObject.CreateInstance\<T>()](/engine/6000.7/script-reference/unityengine/scriptableobject/createinstance.md)
* [Object.GetEntityId()](/engine/6000.7/script-reference/unityengine/object/getentityid.md)
* [Object.GetHashCode()](/engine/6000.7/script-reference/unityengine/object/gethashcode.md)
* [Object.InstantiateAsync\<T>(T)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Transform)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Vector3, Quaternion)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Transform, Vector3, Quaternion)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Vector3, Quaternion)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, Vector3, Quaternion)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>, CancellationToken)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, InstantiateParameters, CancellationToken)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, InstantiateParameters, CancellationToken)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>, InstantiateParameters, CancellationToken)](/engine/6000.7/script-reference/unityengine/object/instantiateasync.md)
* [Object.Instantiate(Object, Vector3, Quaternion)](/engine/6000.7/script-reference/unityengine/object/instantiate.md#instantiate\(object-vector3-quaternion\))
* [Object.Instantiate(Object, Vector3, Quaternion, Transform)](/engine/6000.7/script-reference/unityengine/object/instantiate.md#instantiate\(object-vector3-quaternion-transform\))
* [Object.Instantiate(Object)](/engine/6000.7/script-reference/unityengine/object/instantiate.md#instantiate\(object\))
* [Object.Instantiate(Object, Scene)](/engine/6000.7/script-reference/unityengine/object/instantiate.md#instantiate\(object-scene\))
* [Object.Instantiate\<T>(T, InstantiateParameters)](/engine/6000.7/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion, InstantiateParameters)](/engine/6000.7/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate(Object, Transform)](/engine/6000.7/script-reference/unityengine/object/instantiate.md#instantiate\(object-transform\))
* [Object.Instantiate(Object, Transform, bool)](/engine/6000.7/script-reference/unityengine/object/instantiate.md#instantiate\(object-transform-bool\))
* [Object.Instantiate\<T>(T)](/engine/6000.7/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion)](/engine/6000.7/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion, Transform)](/engine/6000.7/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Transform)](/engine/6000.7/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Transform, bool)](/engine/6000.7/script-reference/unityengine/object/instantiate.md)
* [Object.Destroy(Object, float)](/engine/6000.7/script-reference/unityengine/object/destroy.md)
* [Object.DestroyImmediate(Object, bool)](/engine/6000.7/script-reference/unityengine/object/destroyimmediate.md)
* [Object.FindObjectsByType(Type)](/engine/6000.7/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytype\(type\))
* [Object.FindObjectsByType(Type, FindObjectsInactive)](/engine/6000.7/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytype\(type-findobjectsinactive\))
* [Object.DontDestroyOnLoad(Object)](/engine/6000.7/script-reference/unityengine/object/dontdestroyonload.md)
* [Object.FindAnyObjectByType\<T>()](/engine/6000.7/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytypet\(\))
* [Object.FindAnyObjectByType\<T>(FindObjectsInactive)](/engine/6000.7/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytypet\(findobjectsinactive\))
* [Object.FindObjectsByType\<T>()](/engine/6000.7/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytypet\(\))
* [Object.FindObjectsByType\<T>(FindObjectsInactive)](/engine/6000.7/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytypet\(findobjectsinactive\))
* [Object.FindAnyObjectByType(Type)](/engine/6000.7/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytype\(type\))
* [Object.FindAnyObjectByType(Type, FindObjectsInactive)](/engine/6000.7/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytype\(type-findobjectsinactive\))
* [Object.ToString()](/engine/6000.7/script-reference/unityengine/object/tostring.md)
* [Object.name](/engine/6000.7/script-reference/unityengine/object/name.md)
* [Object.hideFlags](/engine/6000.7/script-reference/unityengine/object/hideflags.md)

### Operators

| Operator                                                                           | Description                                                             |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [operator ==](/engine/6000.7/script-reference/unityengine/object/op-equality.md)   | Compares two object references to see if they refer to the same object. |
| [bool](/engine/6000.7/script-reference/unityengine/object/op-implicit.md)          | Determines whether the object exists.                                   |
| [operator !=](/engine/6000.7/script-reference/unityengine/object/op-inequality.md) | Compares if two objects refer to a different object.                    |
