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. |