# LoadingPreference

> Selects whether the localization system resolves values asynchronously or synchronously when it has the choice.

## Definition

* **Type:** Enum
* **Namespace:** [Unity.Localization](/engine/6000.7/script-reference/unity/localization.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule

```csharp
public enum LoadingPreference
```

## Remarks

This is the default loading behaviour for the event-driven accessors on the reference types, such as [LocalizedString.GetLocalizedStringAsync](/engine/6000.7/script-reference/unity/localization/localizedstring/getlocalizedstringasync.md), [LocalizedAsset\<TObject>.GetLocalizedAssetAsync()](/engine/6000.7/script-reference/unity/localization/localizedasset1/getlocalizedassetasync.md), and [LocalizedTable.GetTableAsync](/engine/6000.7/script-reference/unity/localization/localizedtable/gettableasync.md), and for the change events that call them. Set it through [LocalizationSettings.PreferredLoading](/engine/6000.7/script-reference/unity/localization/localizationsettings/preferredloading.md). The preference is a hint: when [LoadingPreference.Synchronous](/engine/6000.7/script-reference/unity/localization/loadingpreference/synchronous.md) 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](/engine/6000.7/script-reference/unity/localization/localizationsettings/preferredloading.md)

Choose synchronous resolution as the default loading behaviour.

## Examples

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

## Fields

| Value                                                                                                | Description                                                                                        |
| ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| [Asynchronous](/engine/6000.7/script-reference/unity/localization/loadingpreference/asynchronous.md) | Resolves values through an asynchronous load, deferring the result until the content is available. |
| [Synchronous](/engine/6000.7/script-reference/unity/localization/loadingpreference/synchronous.md)   | Resolves values synchronously when possible, falling back to an asynchronous load when it is not.  |
