# GetTable(TableReference, Locale)

> Returns the resource table for a reference if it is already loaded, or null otherwise.

## Definition

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

```csharp
public ResourceTable GetTable(TableReference tableRef, Locale locale = null)
```

### Parameters

**** (\[TableReference]\(/engine/6000.7/script-reference/unity/localization/tablereference)): The reference to the table collection to look up.**** (\[Locale]\(/engine/6000.7/script-reference/unity/localization/locale)): The locale to look up; null uses the selected locale.

### Returns

| Type                                                                                 | Description                                                                                           |
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| [ResourceTable](/engine/6000.7/script-reference/unity/localization/resourcetable.md) | The resource table for the reference in the locale, or null when it cannot be resolved synchronously. |

### Remarks

This is the synchronous companion to [ResourceDatabase.GetTableAsync](/engine/6000.7/script-reference/unity/localization/resourcedatabase/gettableasync.md). It returns a cached table, otherwise it resolves the table through any provider in the chain that implements [ISynchronousAssetProvider](/engine/6000.7/script-reference/unity/localization/providers/isynchronousassetprovider.md), such as direct references or a `Resources` load. A table that only a purely asynchronous provider can supply returns null until [ResourceDatabase.GetTableAsync](/engine/6000.7/script-reference/unity/localization/resourcedatabase/gettableasync.md) loads it. Use it on the main thread when you cannot await.

Reads a table if it is loaded, otherwise loads it asynchronously.

### Examples

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

namespace Unity.Localization.Samples
{
    public class GetTableSyncExample : MonoBehaviour
    {
        async void Start()
        {
            var database = LocalizationSettings.ResourceDatabase;
            ResourceTable table = database.GetTable("UI Text");
            if (table == null)
                table = await database.GetTableAsync("UI Text");
            Debug.Log(table != null ? "loaded" : "missing");
        }
    }
}
```
