Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PrepareAsync(LocalizationSettings, CancellationToken)

Loads whatever the selector needs before it is asked for a locale.
Read time 1 minuteLast updated 7 days ago

Definition

  • Type: Method
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
Awaitable PrepareAsync(LocalizationSettings settings, CancellationToken cancellationToken = default)

Parameters

The localization settings that are initializing.

cancellationToken

The token that signals the preparation should be canceled.

Returns

Type

Description

AwaitableAn Awaitable that completes once the selector is ready to choose.

Remarks

Runs once per initialization. An exception thrown here is logged and the run continues, so the selector should leave itself in a state where IStartupLocaleSelector.GetStartupLocale can return null. Initialization waits for this method, so nothing inside it can wait for initialization. Awaiting LocalizationSettings.InitializeAsync, or a value in the selected locale, waits for this method to return, so it never finishes. To read a value here, pass the locale to read it in.