| Parameter | Description |
|---|---|
| tableRef | The reference to the table collection that holds the entry. |
| entryRef | The reference to the string entry to resolve. |
| locale | The locale to resolve in; null uses the selected locale. |
| args | The Smart String arguments to format placeholders with; null when the entry takes no arguments. |
| cancellationToken | The token that cancels the load operation. |
| enableFallback | Whether to walk the locale fallback chain when the locale has no value. |
| localVariables | The extra variables that Smart String placeholders resolve against, in addition to the arguments. |
Awaitable<string> The formatted localized string, or null when the entry is not a string entry or has no value.
Resolves a localized string, applying Smart formatting and the locale post-processing hook.
The entry loads through the provider chain, following the locale fallback chain when
enableFallback is true. When the entry is marked as Smart, the value is formatted with the
settings' Smart formatter (see LocalizationSettings.GetSmartFormatter) using
args and localVariables. The result is then passed through the locale's
post-processing hook, which pseudo-locales use to transform text. To read an already-loaded value without
awaiting, use ResourceDatabase.GetLocalizedString.
<para>Resolves a Smart String that inserts the player's score.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class GetLocalizedStringWithArgsExample : MonoBehaviour { async void Start() { // Entry "score-message" is a Smart entry: "You scored {0} points" string message = await LocalizationSettings.ResourceDatabase .GetLocalizedStringAsync("UI Text", "score-message", args: new object[] { 42 }); Debug.Log(message); } } }