Class LocalizationSettings | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class LocalizationSettings

    The localization settings is the core component to the localization system. It provides the entry point to all player based localization features.

    Inheritance
    System.Object
    LocalizationSettings
    Namespace: UnityEngine.Localization
    Syntax
    public class LocalizationSettings : ScriptableObject

    Fields

    ConfigName

    The name to use when retrieving the LocalizationSettings from CustomObject API.

    Declaration
    public const string ConfigName = "com.unity.localization.settings"
    Field Value
    Type Description
    System.String

    LocaleLabel

    Label used when searching Addressable assets for Locales.

    Declaration
    public const string LocaleLabel = "Locale"
    Field Value
    Type Description
    System.String

    Properties

    AssetDatabase

    The asset database is responsible for providing localized assets.

    Declaration
    public static LocalizedAssetDatabase AssetDatabase { get; set; }
    Property Value
    Type Description
    LocalizedAssetDatabase

    AvailableLocales

    Declaration
    public static LocalesProvider AvailableLocales { get; set; }
    Property Value
    Type Description
    LocalesProvider

    HasSettings

    Indicates if there is a LocalizationSettings present. If one is not found will attempt to find one however unlike Instance it will not create a default, if one can not be found.

    Declaration
    public static bool HasSettings { get; }
    Property Value
    Type Description
    System.Boolean

    true if has settings; otherwise, false.

    HasStringDatabase

    Does the LocalizationSettings exist and contain a string database?

    Declaration
    public static bool HasStringDatabase { get; }
    Property Value
    Type Description
    System.Boolean

    true if has string database; otherwise, false.

    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.

    Declaration
    public static AsyncOperationHandle<LocalizationSettings>? InitializationOperation { get; }
    Property Value
    Type Description
    System.Nullable<AsyncOperationHandle<LocalizationSettings>>

    Instance

    Singleton instance for the Localization Settings.

    Declaration
    public static LocalizationSettings Instance { get; set; }
    Property Value
    Type Description
    LocalizationSettings

    PreloadBehavior

    TODO: DOC

    Declaration
    public PreloadBehavior PreloadBehavior { get; set; }
    Property Value
    Type Description
    PreloadBehavior

    SelectedLocale

    The current selected locale. This is the locale that will be used when localizing assets.

    Declaration
    public static Locale SelectedLocale { get; set; }
    Property Value
    Type Description
    Locale

    StartupLocaleSelector

    Declaration
    public static StartupLocaleSelector StartupLocaleSelector { get; set; }
    Property Value
    Type Description
    StartupLocaleSelector

    StringDatabase

    The string database is responsible for providing localized string assets.

    Declaration
    public static LocalizedStringDatabase StringDatabase { get; set; }
    Property Value
    Type Description
    LocalizedStringDatabase

    Methods

    CreateDefault(List<ScriptableObject>)

    Creates a LocalizationSettings setup with all the default delegates needed to localize your application.

    Declaration
    public static LocalizationSettings CreateDefault(List<ScriptableObject> createdDependencies = null)
    Parameters
    Type Name Description
    System.Collections.Generic.List<ScriptableObject> createdDependencies

    Optional list which will be populated with additional scriptable objects that are created for the localization settings.

    Returns
    Type Description
    LocalizationSettings

    The new localization settings asset.

    GetAssetDatabase()

    Declaration
    public LocalizedAssetDatabase GetAssetDatabase()
    Returns
    Type Description
    LocalizedAssetDatabase

    GetAvailableLocales()

    Declaration
    public LocalesProvider GetAvailableLocales()
    Returns
    Type Description
    LocalesProvider

    GetInitializationOperation()

    Declaration
    public AsyncOperationHandle<LocalizationSettings>? GetInitializationOperation()
    Returns
    Type Description
    System.Nullable<AsyncOperationHandle<LocalizationSettings>>

    GetInstanceDontCreateDefault()

    Returns the singleton of the LocalizationSettings but does not create a default one if no active settings are found.

    Declaration
    public static LocalizationSettings GetInstanceDontCreateDefault()
    Returns
    Type Description
    LocalizationSettings

    GetPreloadBehavior()

    TODO: DOC

    Declaration
    public PreloadBehavior GetPreloadBehavior()
    Returns
    Type Description
    PreloadBehavior

    GetSelectedLocale()

    Declaration
    public Locale GetSelectedLocale()
    Returns
    Type Description
    Locale

    GetStartupLocaleSelector()

    Declaration
    public StartupLocaleSelector GetStartupLocaleSelector()
    Returns
    Type Description
    StartupLocaleSelector

    GetStringDatabase()

    Returns the string database being used to localize all strings.

    Declaration
    public LocalizedStringDatabase GetStringDatabase()
    Returns
    Type Description
    LocalizedStringDatabase

    The string database.

    OnLocaleRemoved(Locale)

    Declaration
    public void OnLocaleRemoved(Locale locale)
    Parameters
    Type Name Description
    Locale locale

    SetAssetDatabase(LocalizedAssetDatabase)

    Declaration
    public void SetAssetDatabase(LocalizedAssetDatabase database)
    Parameters
    Type Name Description
    LocalizedAssetDatabase database

    SetAvailableLocales(LocalesProvider)

    Declaration
    public void SetAvailableLocales(LocalesProvider available)
    Parameters
    Type Name Description
    LocalesProvider available

    SetPreloadBehavior(PreloadBehavior)

    TODO: DOC

    Declaration
    public void SetPreloadBehavior(PreloadBehavior behavior)
    Parameters
    Type Name Description
    PreloadBehavior behavior

    SetSelectedLocale(Locale)

    Declaration
    public void SetSelectedLocale(Locale locale)
    Parameters
    Type Name Description
    Locale locale

    SetStartupLocaleSelector(StartupLocaleSelector)

    Declaration
    public void SetStartupLocaleSelector(StartupLocaleSelector selector)
    Parameters
    Type Name Description
    StartupLocaleSelector selector

    SetStringDatabase(LocalizedStringDatabase)

    Sets the string database to be used for localizing all strings.

    Declaration
    public void SetStringDatabase(LocalizedStringDatabase database)
    Parameters
    Type Name Description
    LocalizedStringDatabase database

    Events

    OnSelectedLocaleChanged

    Declaration
    public event Action<Locale> OnSelectedLocaleChanged
    Event Type
    Type Description
    System.Action<Locale>

    SelectedLocaleChanged

    Event that is sent when the SelectedLocale is changed.

    Declaration
    public static event Action<Locale> SelectedLocaleChanged
    Event Type
    Type Description
    System.Action<Locale>
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023