Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetTableAsync(CancellationToken)

Resolves the table asynchronously for the reference's locale.
Read time 1 minuteLast updated 7 days ago

Definition

  • Type: Method
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
public Awaitable<ResourceTable> GetTableAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken

A token that cancels the asynchronous load. The default token never cancels.

Returns

Type

Description

Awaitable<ResourceTable>An awaitable that produces the resolved table, or null when it cannot be resolved.

Remarks

Loads the table through the ResourceDatabase provider chain if needed. The result is null when the reference is empty, no resource database is configured, or the table cannot be found. When LocalizationSettings.PreferredLoading is LoadingPreference.Synchronous and the table is available synchronously, the table resolves without an asynchronous load.
Load a table asynchronously.

Examples

using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class LocalizedTableGetTableAsyncExample { public async Awaitable Load() { var localizedTable = new LocalizedTable(); localizedTable.TableReference = "My Strings"; ResourceTable table = await localizedTable.GetTableAsync(); if (table != null) Debug.Log(table.name); } }}