void DrawInspectorToggleBtn(string label, Color btnColor, UnityEngine.Object objToInspect, ref EditorWindow inspectorWindow, ref bool showInspectorFlag) { if (objToInspect != null) { var style = new GUIStyle(GUI.skin.button); GUI.backgroundColor = btnColor; showInspectorFlag = GUILayout.Toggle(showInspectorFlag, label, style, GUILayout.Width(120), GUILayout.Height(40)); if (showInspectorFlag) { if (inspectorWindow == null) { inspectorWindow = GetInspectTarget(objToInspect); inspectorWindow.Show(); DockUtilities.DockWindow(win, inspectorWindow, DockUtilities.DockPosition.Right); } } else { if (inspectorWindow != null) { inspectorWindow.Close(); } } GUI.backgroundColor = GUI.color; } }
private void OnGUI() { if (GUILayout.Button("显示额外Inspector面板")) { inspectorWindow = GetInspectTarget(m_MoreInspectorSOForTest); inspectorWindow.Show(); DockUtilities.DockWindow(this, inspectorWindow, DockUtilities.DockPosition.Right); } }