Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetEntryAsync(TableReference, TableEntryReference, Locale, CancellationToken, bool)

Resolves an entry, following the locale fallback chain when the entry is missing or empty.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Method
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
public Awaitable<IResourceEntry> GetEntryAsync(TableReference tableRef, TableEntryReference entryRef, Locale locale = null, CancellationToken cancellationToken = default, bool enableFallback = true)

Parameters

The reference to the table collection that holds the entry.

The reference to the entry to resolve within the table.

locale

The locale to resolve in; null uses the selected locale.

cancellationToken

The token that cancels the load operation.

enableFallback

Whether to walk the locale fallback chain when the locale has no usable value.

Returns

Type

Description

Awaitable<IResourceEntry>The resolved entry, or null when neither the locale nor its fallback chain has a usable value.

Remarks

The entry loads through the provider chain. When the requested locale has no usable value, resolution walks the fallback chain defined by Locale.FallbackCode until it finds a value or the chain ends. The result is a raw IResourceEntry; to get a formatted string or a loaded asset, use ResourceDatabase.GetLocalizedStringAsync or ResourceDatabase.GetLocalizedAssetAsync instead.
Resolves an entry and reads it when it is a string entry.

Examples

using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class GetEntryAsyncExample : MonoBehaviour { async void Start() { IResourceEntry entry = await LocalizationSettings.ResourceDatabase.GetEntryAsync("UI Text", "hello"); if (entry is IStringEntry stringEntry) Debug.Log(stringEntry.Value); } }}