| Parameter | Description |
|---|---|
| tableRef | The reference to the table collection to look up. |
| locale | The locale to look up; null uses the selected locale. |
ResourceTable The resource table for the reference in the locale, or null when it cannot be resolved synchronously.
Returns the resource table for a reference if it is already loaded, or null otherwise.
This is the synchronous companion to ResourceDatabase.GetTableAsync. It returns a cached table, otherwise it
resolves the table through any provider in the chain that implements ISynchronousAssetProvider,
such as direct references or a Resources load. A table that only a purely asynchronous provider can
supply returns null until ResourceDatabase.GetTableAsync loads it. Use it on the main thread when you cannot await.
<para>Reads a table if it is loaded, otherwise loads it asynchronously.</para>
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"); } } }