Class LocalizationSettings
The localization settings is the core component to the localization system. It provides the entry point to all player based localization features.
Implements
Inherited Members
Namespace: UnityEngine.Localization.Settings
Assembly: Unity.Localization.dll
Syntax
public class LocalizationSettings : ScriptableObject, IReset
Properties
Name | Description |
---|---|
AssetDatabase | The asset database is responsible for providing localized assets. |
AvailableLocales | |
HasSettings | Indicates if there is a LocalizationSettings present. If one is not found then it will attempt to find one however unlike Instance it will not create a default, if one can not be found. |
InitializationOperation | The localization system may not be immediately ready. Loading Locales, preloading assets etc. This operation can be used to check when the system is ready. You can yield on this in a coroutine to wait. If InitializeSynchronously is true then this operation will complete synchronously the first time it is called. Uses WaitForCompletion to force the loading to complete synchronously. Please note that WaitForCompletion is not supported on WebGL and InitializeSynchronously will be ignored when running on WebGL. |
InitializeSynchronously | Forces the InitializationOperation to complete immediately when it is started. Uses WaitForCompletion to force the loading to complete synchronously. Please note that WaitForCompletion is not supported on WebGL and InitializeSynchronously will be ignored when running on WebGL. |
Instance | Singleton instance for the Localization Settings. |
Metadata | Returns the Localization Settings Metadata. Metadata can be used to contain additional information such as App Name localization settings. |
PreloadBehavior | Determines which tables, that have been marked as preload, will be loaded during the preloading step. |
ProjectLocale | When tracking property variants in a scene, any changes you make whilst in this Locale are saved into the source object instead of as a variant. |
SelectedLocale | The current selected Locale. This is the Locale that will be used by default when localizing assets and strings. Calling this when the Localization system has not initialized will force the Localization system to load all Locales before returning, see SelectedLocaleAsync for a version that will load the Locales asynchronously. |
SelectedLocaleAsync | The current selected Locale. This is the Locale that will be used by default when localizing assets and strings. If InitializationOperation has not been completed yet then this will wait for the AvailableLocales part to complete first. It will not wait for the entire InitializationOperation but just the part that initializes the Locales. See SelectedLocale for a synchronous version that will block until the Locales have been loaded. |
StartupLocaleSelectors | Determines what locale should be used for the SelectedLocale when the application starts or does not currently have an active SelectedLocale. |
StringDatabase | The string database is responsible for providing localized string assets. |
Methods
Name | Description |
---|---|
GetAssetDatabase() | The asset database is responsible for providing localized assets. |
GetAvailableLocales() | |
GetInitializationOperation() | The localization system may not be immediately ready. Loading Locales, preloading assets etc. This operation can be used to check when the system is ready. You can yield on this in a coroutine to wait. If InitializeSynchronously is true then this operation will complete synchronously the first time it is called. Uses WaitForCompletion to force the loading to complete synchronously. Please note that WaitForCompletion is not supported on WebGL and InitializeSynchronously will be ignored when running on WebGL. |
GetInstanceDontCreateDefault() | Returns the singleton of the LocalizationSettings but does not create a default one if no active settings are found. |
GetMetadata() | Returns the Localization Settings Metadata. Metadata can be used to contain additional information such as App Name localization settings. |
GetSelectedLocale() | The current selected Locale. This is the Locale that will be used by default when localizing assets and strings. Calling this when the Localization system has not initialized will force the Localization system to load all Locales before returning, see SelectedLocaleAsync for a version that will load the Locales asynchronously. |
GetSelectedLocaleAsync() | The current selected Locale. This is the Locale that will be used by default when localizing assets and strings. If InitializationOperation has not been completed yet then this will wait for the AvailableLocales part to complete first. It will not wait for the entire InitializationOperation but just the part that initializes the Locales. See SelectedLocale for a synchronous version that will block until the Locales have been loaded. |
GetStartupLocaleSelectors() | Determines what locale should be used for the SelectedLocale when the application starts or does not currently have an active SelectedLocale. |
GetStringDatabase() | Returns the string database being used to localize all strings. |
OnLocaleRemoved(Locale) | Indicates that the Locale is no longer available. If the locale is the current SelectedLocale then a new one will be found using StartupLocaleSelectors. |
ResetState() | Resets the internal state of the object so it is ready to be used again and does not contain any data left over from a previous run. |
SelectLocaleUsingStartupSelectors() | Uses StartupLocaleSelectors to select the most appropriate Locale. |
SetAssetDatabase(LocalizedAssetDatabase) | The asset database is responsible for providing localized assets. |
SetAvailableLocales(ILocalesProvider) | |
SetSelectedLocale(Locale) | The current selected Locale. This is the Locale that will be used by default when localizing assets and strings. Calling this when the Localization system has not initialized will force the Localization system to load all Locales before returning, see SelectedLocaleAsync for a version that will load the Locales asynchronously. |
SetStringDatabase(LocalizedStringDatabase) | Sets the string database to be used for localizing all strings. |
Events
Name | Description |
---|---|
OnSelectedLocaleChanged | Called when the SelectedLocale is changed. This will be called after InitializationOperation is completed so any preloading operations will be finished. |
SelectedLocaleChanged | Event that is sent when the SelectedLocale is changed. |