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

LocalizedEntry<T0>.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<TEntry> GetEntryAsync(CancellationToken cancellationToken);

Parameters

Parameter Description
cancellationToken A token that cancels the asynchronous load. The default token never cancels.

Returns

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

Description

Resolves the entry asynchronously, loading the table if it is not already available.

The entry is resolved as TEntry through the ResourceDatabase provider chain, following the locale fallback chain when LocalizedReference.EnableFallback is set. The result is null when the reference is empty, no resource database is configured, or the entry cannot be found. The resolved entry is cached and reused until the reference changes or the resolving locale changes, so repeated calls do not resolve again. The LocalizedString and LocalizedAsset<T0> types build on this cache to format or load the same entry without resolving it every time.

<para>Load an entry asynchronously.</para>

using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples { public class LocalizedEntryGetEntryAsyncExample { public async Awaitable Load() { var reference = new LocalizedString(); reference.SetReference("My Strings", "HELLO"); var entry = await reference.GetEntryAsync(); if (entry != null) Debug.Log(entry.Value); } } }