Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CommandLineLocaleSelector

Selects the locale from a command line argument, such as -language=fr.
Read time 1 minuteLast updated 13 days ago

Definition

public class CommandLineLocaleSelector : IStartupLocaleSelector

Remarks

On startup this selector scans the command line for the prefix set by CommandLineLocaleSelector.CommandLineArgument (
-language=
by default) and selects the locale whose LocaleIdentifier matches the value that follows, for example
-language=fr
. If the argument is absent or no available locale matches, GetStartupLocale returns null and the next selector in LocalizationSettings.StartupSelectors runs. This selector is part of the default selector chain, ahead of SystemLocaleSelector.
Reads the locale from the command line when the player starts.

Examples

using Unity.Localization;namespace Unity.Localization.Samples{ public class CommandLineLocaleSelectorExample { // Launch the player with: MyGame.exe -language=fr public Locale Run() { var selector = new CommandLineLocaleSelector(); Locale locale = selector.GetStartupLocale(LocalizationSettings.Instance); return locale; } }}

Properties

Property

Description

CommandLineArgumentThe command line argument prefix used to assign the locale.