void DrawTabs() { DrawTabTitle("General"); if (DrawTabButton("UI")) { //editor = CreateInstance<UIAssistantEditor>(); editorRender = editor.OnInspectorGUI; } if (DrawTabButton("DataManager-Flag")) { editor = CreateInstance <DataManagerEditorFlag>(); editorRender = editor.Show; } if (DrawTabButton("SceneFlag")) { editor = CreateInstance <SceneFlagManagerEditor>(); editorRender = editor.OnInspectorGUI; } if (DrawTabButton("Chest")) { editor = CreateInstance <ChestManagerEditor>(); editorRender = editor.OnInspectorGUI; } }
void OnGUI() { if (editorRender == null || editor == null) { editorRender = null; editor = null; } defalutColor = GUI.backgroundColor; EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); GUI.backgroundColor = bgColor; EditorGUILayout.BeginVertical(EditorStyles.textArea, GUILayout.Width(150), GUILayout.ExpandHeight(true)); GUI.backgroundColor = defalutColor; tabsScroll = EditorGUILayout.BeginScrollView(tabsScroll); DrawTabs(); EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); GUI.backgroundColor = bgColor; EditorGUILayout.BeginVertical(EditorStyles.textArea, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); GUI.backgroundColor = defalutColor; editorScroll = EditorGUILayout.BeginScrollView(editorScroll); if (!string.IsNullOrEmpty(editorTitle)) { DrawTitle(editorTitle); } if (editor != null) { editorRender.Invoke(); } else { GUILayout.Label("Nothing selected"); } EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }