# Synchronous and asynchronous loading

> Understand when localized content loads synchronously and when it must load asynchronously.

Understand when localized content loads synchronously and when it must load asynchronously.

Every accessor in Localization comes in two forms: a synchronous call that returns the value directly, and an asynchronous one that returns an [`Awaitable`](https://docs.unity3d.com/ScriptReference/Awaitable.html) and accepts a `CancellationToken`. For example, use [`GetLocalizedString`](/engine/6000.7/script-reference/unity/localization/localizedstring/getlocalizedstring.md) for the synchronous form and [`GetLocalizedStringAsync`](/engine/6000.7/script-reference/unity/localization/localizedstring/getlocalizedstringasync.md) for the asynchronous form. For more information about `CancellationToken`, refer to [CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken) (Microsoft).

## When synchronous calls work

A synchronous call succeeds when everything it needs is already loaded or can load without waiting. That depends on the content source serving the value:

* Direct references are in memory after the table loads, so they resolve synchronously.
* A `Resources` folder source loads both ways.
* Other sources, for example a source that reads files or downloaded content, might only load asynchronously.

When a synchronous call can't produce the value, it returns nothing and you must request the content asynchronously instead.

```cs
// The synchronous call returns the value directly when the content can load synchronously.
            string value = scoreText.GetLocalizedString();
```

## The loading preference

Event-driven paths, such as [`StringChanged`](/engine/6000.7/script-reference/unity/localization/localizedstring/stringchanged.md), components, and UI Toolkit bindings, follow the [`PreferredLoading`](/engine/6000.7/script-reference/unity/localization/localizationsettings/preferredloading.md) setting:

| **Value**        | **Description**                                                                                                                                 |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **Asynchronous** | Values resolve in the background and arrive through events. The default.                                                                        |
| **Synchronous**  | Values resolve immediately when they can. When a value can't resolve synchronously, it falls back to the asynchronous path rather than failing. |

Synchronous loading keeps UI updates on the same frame, but blocks on any load the source performs.

## Initialization

The first request triggers initialization automatically. To front-load it, for example behind a splash screen, await [`InitializeAsync`](/engine/6000.7/script-reference/unity/localization/localizationsettings/initializeasync.md):

```csharp
await LocalizationSettings.InitializeAsync();
```

Localization raises [`InitializationCompleted`](/engine/6000.7/script-reference/unity/localization/localizationsettings/initializationcompleted.md) when initialization finishes.

## Additional resources

* [How localization works](/engine/6000.7/manual/localization/how-localization-works.md)
* [Content sources](/engine/6000.7/manual/localization/content-storage-and-loading/content-sources.md)
* [Localize assets](/engine/6000.7/manual/localization/translations/localize-assets.md)
