void CreateSettingsGUI() { if (LocalizationEditorSettings.ActiveLocalizationSettings == null) { if (m_Editor != null) { m_Editor.RemoveFromHierarchy(); m_Editor = null; } EditorGUI.BeginChangeCheck(); var obj = EditorGUILayout.ObjectField(s_Texts.activeSettings, LocalizationEditorSettings.ActiveLocalizationSettings, typeof(LocalizationSettings), false) as LocalizationSettings; if (EditorGUI.EndChangeCheck()) { LocalizationEditorSettings.ActiveLocalizationSettings = obj; } EditorGUILayout.HelpBox(s_Texts.noSettingsMsg.text, MessageType.Info, true); if (GUILayout.Button("Create", GUILayout.Width(100))) { var created = LocalizationSettingsMenuItems.CreateLocalizationAsset(); if (created != null) { LocalizationEditorSettings.ActiveLocalizationSettings = created; } } } else if (Event.current.type != EventType.Layout && m_Editor == null) { m_Editor = new InspectorElement(LocalizationEditorSettings.ActiveLocalizationSettings); m_Root.Add(m_Editor); } }
public override void OnGUI(string searchContext) { if (LocalizationEditorSettings.ActiveLocalizationSettings == null) { EditorGUI.BeginChangeCheck(); var obj = EditorGUILayout.ObjectField(s_Texts.activeSettings, LocalizationEditorSettings.ActiveLocalizationSettings, typeof(LocalizationSettings), false) as LocalizationSettings; if (EditorGUI.EndChangeCheck()) { LocalizationEditorSettings.ActiveLocalizationSettings = obj; // Trigger the activate so it generates a new Editor base.OnActivate(m_SearchContext, m_RootElement); } EditorGUILayout.HelpBox(s_Texts.noSettingsMsg.text, MessageType.Info, true); if (GUILayout.Button("Create", GUILayout.Width(100))) { var created = LocalizationSettingsMenuItems.CreateLocalizationAsset(); if (created != null) { LocalizationEditorSettings.ActiveLocalizationSettings = created; // Trigger the activate so it generates a new Editor base.OnActivate(m_SearchContext, m_RootElement); } } } else { base.OnGUI(searchContext); } }