Selects the locale from a command line argument, such as -language=fr.
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,
CommandLineLocaleSelector.GetStartupLocale returns null and the next selector in
LocalizationSettings.StartupSelectors runs. This selector is part of the default selector chain,
ahead of SystemLocaleSelector.
Additional resources: IStartupLocaleSelector, LocalizationSettings
<para>Reads the locale from the command line when the player starts.</para>
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; } } }
| Property | Description |
|---|---|
| CommandLineArgument | The command line argument prefix used to assign the locale. |