docs.unity3d.com
    Show / Hide Table of Contents

    Interface IStartupLocaleSelector

    Determines what locale should be used for the SelectedLocale when the application starts or does not currently have an active SelectedLocale.

    Namespace: UnityEngine.Localization.Settings
    Syntax
    public interface IStartupLocaleSelector
    Examples

    This example shows how to implement a custom selector. Once implemented, you can add the custom selector in the Startup Selectors menu.

    using System;
    using UnityEngine;
    using UnityEngine.Localization;
    using UnityEngine.Localization.Settings;
    
    [DisplayName("My Startup Selector")]
    [Serializable]
    public class StartupSelectorExample : IStartupLocaleSelector
    {
    // Allow the user to select a specific language to use.
    public SystemLanguage language;
    
    public Locale GetStartupLocale(ILocalesProvider availableLocales)
    {
        // Return the Locale that matches the language field or null if one does not exist.
        return availableLocales.GetLocale(language);
    }
    }

    Methods

    GetStartupLocale(ILocalesProvider)

    Used to determine which Locale should be used.

    Declaration
    Locale GetStartupLocale(ILocalesProvider availableLocales)
    Parameters
    Type Name Description
    ILocalesProvider availableLocales

    The available locales to select from.

    Returns
    Type Description
    Locale

    The selected locale or null. StartupLocaleSelectors will evaluate each selector until a non-null value is returned, this value will become the SelectedLocale.

    Back to top
    Terms of use
    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