private void OnGUI() { EditorGUI.BeginChangeCheck(); GUILayout.BeginHorizontal(); GUILayout.Label("Add Locale"); showSpecificLocales = GUILayout.Toggle(showSpecificLocales, "Show country/region specific locales?"); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool(Constants.SHOW_SPECIFIC_LOCALES_PREFS_KEY, showSpecificLocales); allLocales = Locale.GetAllLocales(showSpecificLocales); UpdateFilter(); } EditorGUI.BeginChangeCheck(); searchQuery = GUILayout.TextField(searchQuery); if (string.IsNullOrEmpty(searchQuery)) { var guiColor = GUI.color; GUI.color = Color.grey; var lastRect = GUILayoutUtility.GetLastRect(); lastRect.x += 4; lastRect.width -= 4; EditorGUI.LabelField(lastRect, "Search locales"); GUI.color = guiColor; } if (EditorGUI.EndChangeCheck()) { UpdateFilter(); } scrollPosition = GUILayout.BeginScrollView(scrollPosition); for (var index = 0; index < filteredLocales.Count; index++) { var locale = filteredLocales[index]; var back = GUI.backgroundColor; GUI.backgroundColor = index % 2 == 0 ? Color.white : new Color(0.07f, 0.07f, 0.07f); GUILayout.BeginHorizontal("box"); GUI.backgroundColor = back; GUILayout.Label($"{locale.EnglishName} ({locale.NativeName}) - {locale.LocaleCode}"); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add", GUILayout.MinWidth(100))) { Utils.RecordChange(settings, "Added locale"); settings.AddLocale(locale); Utils.SaveChanges(); Utils.DirtyLocales(settings); UpdateFilter(); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); }