void OnGUI() { Localizations = SavedSettings.Localizations; Languages = SavedSettings.Languages; GUILayout.Label("Localization Settings", EditorStyles.boldLabel); if (GUILayout.Button("Import CSV")) { string path = EditorUtility.OpenFilePanel("Import CSV", "", "csv"); if (path.Length != 0) { byte[] fileBytes = File.ReadAllBytes(path); string fileString = System.Text.Encoding.UTF8.GetString(fileBytes); ImportCSV(fileString); return; } } GUILayout.BeginHorizontal(EditorStyles.helpBox); { GUILayout.BeginVertical(EditorStyles.helpBox); { GUILayout.BeginHorizontal(EditorStyles.helpBox); { if (GUILayout.Button("Clear All")) { Languages.Clear(); Localizations.Clear(); } } GUILayout.EndVertical(); GUILayout.BeginHorizontal(EditorStyles.helpBox); { if (GUILayout.Button("Add Language")) { Languages.Add("New Language"); } } GUILayout.EndVertical(); EditorGUILayout.TextField("IDs"); } GUILayout.EndVertical(); int languageIndexToRemove = -1; for (int i = 0; i < Languages.Count; i++) { GUILayout.BeginVertical(EditorStyles.helpBox); { Languages[i] = EditorGUILayout.TextField(Languages[i]); GUILayout.BeginHorizontal(EditorStyles.helpBox); { if (GUILayout.Button("Remove")) { languageIndexToRemove = i; } } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } if (languageIndexToRemove >= 0) { Languages.RemoveAt(languageIndexToRemove); } } GUILayout.EndHorizontal(); DrawLine(2); List <LocalizationData> TempLocalizations = new List <LocalizationData>(); int indexToRemove = -1; for (int i = 0; i < Localizations.Count; i++) { GUILayout.BeginVertical(EditorStyles.helpBox); { LocalizationData CurrentRow = Localizations[i]; GUILayout.BeginHorizontal(EditorStyles.helpBox); { LocalizationData currentValue = new LocalizationData(Languages.Count); currentValue.ID = EditorGUILayout.TextField(CurrentRow.ID); for (int j = 0; j < Languages.Count; j++) { string currentLocalizationText = "N/A"; if (CurrentRow.Localization.Count > j) { currentLocalizationText = CurrentRow.Localization[j]; } currentValue.Localization[j] = EditorGUILayout.TextField(currentLocalizationText); } TempLocalizations.Add(currentValue); } GUILayout.EndHorizontal(); if (GUILayout.Button("Remove Entry")) { indexToRemove = i; } } GUILayout.EndVertical(); } if (indexToRemove >= 0) { TempLocalizations.RemoveAt(indexToRemove); } Localizations = TempLocalizations; DrawLine(2); if (GUILayout.Button("Add Entry")) { Localizations.Add(new LocalizationData(Languages.Count)); } if (SavedSettings != null) { SavedSettings.Save(Localizations, Languages); } else { Debug.LogError("Localization Settings couldn't be found. Localization won't be saved"); } }