| Parameter | Description |
|---|---|
| tableRef | The reference to the table collection to load. |
| locale | The locale to load the table for; null uses the selected locale. |
| cancellationToken | The token that cancels the load operation. |
Awaitable<ResourceTable> The loaded resource table, or null when no table matches the reference in the locale.
Loads the resource table for a table reference in a locale through the provider chain.
The table loads asynchronously through the AssetProvider chain and is cached per locale, so
repeated calls for the same table and locale reuse the loaded instance. Call this when you need the whole
table, for example to enumerate its entries; to resolve a single value prefer
ResourceDatabase.GetLocalizedStringAsync or ResourceDatabase.GetLocalizedAssetAsync. If the settings have not
initialized yet, the first call triggers LocalizationSettings.InitializeAsync.
<para>Loads a table and reports the locale it was loaded for.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class GetTableAsyncExample : MonoBehaviour { async void Start() { var database = LocalizationSettings.ResourceDatabase; ResourceTable table = await database.GetTableAsync("UI Text"); if (table != null) Debug.Log($"Loaded table for {LocalizationSettings.SelectedLocale?.Code}"); } } }