ActiveSettings
Gets or sets the active localization settings for the project.
Read time 1 minuteLast updated 6 hours ago
Definition
- Type: Property
- Namespace: Unity.Localization.Editor
- Assembly: UnityEditor
public static LocalizationSettings ActiveSettings { get; set; }
Remarks
The value is persisted as an EditorBuildSettings config object and included in player builds. Setting it to removes the config object. The settings must be saved as an asset first, for example with AssetDatabase.CreateAsset. Getting the value returns when the project has no active settings.
nullnullAdditional Resources: LocalizationEditorSettings.CreateCollection, LocalizationSettings
Creates a settings asset with two locales and makes it the active settings.
Examples
using Unity.Localization.Editor;using UnityEditor;using UnityEngine;namespace Unity.Localization.Samples{ public class ActiveSettingsExample { public void Run() { if (LocalizationEditorSettings.ActiveSettings != null) return; var settings = ScriptableObject.CreateInstance<LocalizationSettings>(); settings.AddLocale(new Locale("en", "English")); settings.AddLocale(new Locale("fr", "French")); AssetDatabase.CreateAsset(settings, AssetDatabase.GenerateUniqueAssetPath("Assets/Localization Settings.asset")); LocalizationEditorSettings.ActiveSettings = settings; } }}