Selects whether the localization system resolves values asynchronously or synchronously when it has the choice.
This is the default loading behaviour for the event-driven accessors on the reference types, such as
LocalizedString.GetLocalizedStringAsync, LocalizedAsset<T0>.GetLocalizedAssetAsync,
and LocalizedTable.GetTableAsync, and for the change events that call them. Set it through
LocalizationSettings.PreferredLoading. The preference is a hint: when LoadingPreference.Synchronous is
chosen but a value cannot be resolved synchronously (for example the table is only available through an asynchronous
provider), the accessor falls back to an asynchronous load.
Additional resources: LocalizationSettings.PreferredLoading
<para>Choose synchronous resolution as the default loading behaviour.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class PreferredLoadingExample : MonoBehaviour { [SerializeField] LocalizedString m_Greeting = new();
void OnEnable() { LocalizationSettings.PreferredLoading = LoadingPreference.Synchronous; m_Greeting.StringChanged += OnGreetingChanged; }
void OnDisable() => m_Greeting.StringChanged -= OnGreetingChanged;
void OnGreetingChanged(string value) => Debug.Log(value); } }
| Property | Description |
|---|---|
| Asynchronous | Resolves values through an asynchronous load, deferring the result until the content is available. |
| Synchronous | Resolves values synchronously when possible, falling back to an asynchronous load when it is not. |