Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

ResourceDatabase.GetEntryAsync

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public Awaitable<IResourceEntry> GetEntryAsync(TableReference tableRef, TableEntryReference entryRef, Locale locale, CancellationToken cancellationToken, bool enableFallback);

Parameters

Parameter Description
tableRef The reference to the table collection that holds the entry.
entryRef 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

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

Description

Resolves an entry, following the locale fallback chain when the entry is missing or empty.

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.

<para>Resolves an entry and reads it when it is a string entry.</para>

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); } } }