//static Vector2 scrollPos; public static void HandleWindowGUI(EditorWindow window) { TooltipUtility.InitToolTip(window); var originalSkin = GUI.skin; { var height = OnEditModeSelectionGUI(); //var applyOffset = !TooltipUtility.FoundToolTip(); EditorGUILayout.Space(); ShowRealtimeCSGDisabledMessage(); //scrollPos = EditorGUILayout.BeginScrollView(scrollPos); { EditorGUI.BeginDisabledGroup(!RealtimeCSG.CSGSettings.EnableRealtimeCSG); { if (EditModeManager.ActiveTool != null) { EditModeManager.ActiveTool.OnInspectorGUI(window, height); } } EditorGUI.EndDisabledGroup(); } //EditorGUILayout.EndScrollView(); //if (applyOffset) // TooltipUtility.HandleAreaOffset(scrollPos); GUILayout.Label(VersionLabel, EditorStyles.miniLabel); } GUI.skin = originalSkin; TooltipUtility.DrawToolTip(); }
static void HandleSceneGUI(int id) { var sceneView = SceneView.currentDrawingSceneView; TooltipUtility.InitToolTip(sceneView); var originalSkin = GUI.skin; { OnEditModeSelectionSceneGUI(); var viewRect = new Rect(4, 0, sceneView.position.width, sceneView.position.height - (CSG_GUIStyleUtility.BottomToolBarHeight + 4)); GUILayout.BeginArea(viewRect); if (EditModeManager.ActiveTool != null) { EditModeManager.ActiveTool.OnSceneGUI(viewRect); } GUILayout.EndArea(); if (RealtimeCSG.CSGSettings.EnableRealtimeCSG) { SceneViewBottomBarGUI.ShowGUI(sceneView, haveOffset: false); } } GUI.skin = originalSkin; Handles.BeginGUI(); TooltipUtility.DrawToolTip(getLastRect: false); Handles.EndGUI(); }
static void HandleSceneGUI(int id) { var sceneView = SceneView.currentDrawingSceneView; TooltipUtility.InitToolTip(sceneView); var originalSkin = GUI.skin; { if (!SceneDragToolManager.IsDraggingObjectInScene) { OnEditModeSelectionSceneGUI(); } #if UNITY_2018_3_OR_NEWER var viewRect = new Rect(4, 0, sceneView.rootVisualElement.contentRect.width, sceneView.rootVisualElement.contentRect.height - (CSG_GUIStyleUtility.BottomToolBarHeight + 4)); #else var viewRect = new Rect(4, 0, sceneView.position.width, sceneView.position.height - (CSG_GUIStyleUtility.BottomToolBarHeight + 4)); #endif GUILayout.BeginArea(viewRect); if (EditModeManager.ActiveTool != null) { EditModeManager.ActiveTool.OnSceneGUI(viewRect); } GUILayout.EndArea(); if (RealtimeCSG.CSGSettings.EnableRealtimeCSG && !SceneDragToolManager.IsDraggingObjectInScene) { SceneViewBottomBarGUI.ShowGUI(sceneView, haveOffset: false); } } GUI.skin = originalSkin; Handles.BeginGUI(); TooltipUtility.DrawToolTip(getLastRect: false); Handles.EndGUI(); }
internal static void OnScene(SceneView sceneView) { if (!RealtimeCSG.CSGSettings.EnableRealtimeCSG) { return; } if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } UpdateLoop.UpdateOnSceneChange(); if (!RealtimeCSG.CSGSettings.EnableRealtimeCSG) { ColorSettings.isInitialized = false; } else if (!ColorSettings.isInitialized) { if (Event.current.type == EventType.Repaint) { ColorSettings.Update(); } } if (!UpdateLoop.IsActive()) { UpdateLoop.ResetUpdateRoutine(); } if (Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag) { mousePressed = true; } else if (Event.current.type == EventType.MouseUp || Event.current.type == EventType.MouseMove) { mousePressed = false; } SceneDragToolManager.OnHandleDragAndDrop(sceneView); RectangleSelectionManager.Update(sceneView); EditModeManager.InitSceneGUI(sceneView); if (Event.current.type == EventType.Repaint) { MeshInstanceManager.RenderHelperSurfaces(sceneView); } if (Event.current.type == EventType.Repaint) { SceneToolRenderer.OnPaint(sceneView); } else //if (fallbackGUI) { SceneViewBottomBarGUI.ShowGUI(sceneView); SceneViewInfoGUI.DrawInfoGUI(sceneView); } EditModeManager.OnSceneGUI(sceneView); //if (fallbackGUI) { TooltipUtility.InitToolTip(sceneView); if (Event.current.type == EventType.Repaint) { SceneViewBottomBarGUI.ShowGUI(sceneView); SceneViewInfoGUI.DrawInfoGUI(sceneView); } if (!mousePressed) { Handles.BeginGUI(); TooltipUtility.DrawToolTip(getLastRect: false); Handles.EndGUI(); } } if (Event.current.type == EventType.Layout) { var currentFocusControl = CSGHandles.FocusControl; if (prevFocusControl != currentFocusControl) { prevFocusControl = currentFocusControl; HandleUtility.Repaint(); } } }
static public void OnInspectorGUI(Editor editor, UnityEngine.Object[] targets) { TooltipUtility.InitToolTip(editor); try { var models = new CSGModel[targets.Length]; for (int i = targets.Length - 1; i >= 0; i--) { models[i] = targets[i] as CSGModel; if (!models[i]) { ArrayUtility.RemoveAt(ref models, i); } } CSG_GUIStyleUtility.InitStyles(); ShowRealtimeCSGDisabledMessage(); if (models.Length > 0 && models.Length == targets.Length) { CSGModelComponentInspectorGUI.OnInspectorGUI(targets); return; } var filteredSelection = EditModeManager.FilteredSelection; var targetNodes = filteredSelection.NodeTargets; var targetModels = filteredSelection.ModelTargets; var targetBrushes = filteredSelection.BrushTargets; var targetOperations = filteredSelection.OperationTargets; if (targetNodes == null) { return; } bool?isPrefab = false; PrefabInstantiateBehaviour?prefabBehaviour = PrefabInstantiateBehaviour.Reference; PrefabSourceAlignment? prefabSourceAlignment = PrefabSourceAlignment.AlignedTop; PrefabDestinationAlignment?prefabDestinationAlignment = PrefabDestinationAlignment.AlignToSurface; if (targetNodes.Length > 0) { var gameObject = targetNodes[0].gameObject; isPrefab = CSGPrefabUtility.IsPrefabAsset(gameObject); prefabBehaviour = targetNodes[0].PrefabBehaviour; prefabSourceAlignment = targetNodes[0].PrefabSourceAlignment; prefabDestinationAlignment = targetNodes[0].PrefabDestinationAlignment; for (int i = 1; i < targetNodes.Length; i++) { gameObject = targetNodes[i].gameObject; var currentIsPrefab = CSGPrefabUtility.IsPrefabAsset(gameObject); var currentPrefabBehaviour = targetNodes[i].PrefabBehaviour; var currentPrefabSourceAlignment = targetNodes[i].PrefabSourceAlignment; var currentPrefabDestinationAlignment = targetNodes[i].PrefabDestinationAlignment; if (isPrefab.HasValue && isPrefab.Value != currentIsPrefab) { isPrefab = null; } if (prefabBehaviour.HasValue && prefabBehaviour.Value != currentPrefabBehaviour) { prefabBehaviour = null; } if (prefabSourceAlignment.HasValue && prefabSourceAlignment.Value != currentPrefabSourceAlignment) { prefabSourceAlignment = null; } if (prefabDestinationAlignment.HasValue && prefabDestinationAlignment.Value != currentPrefabDestinationAlignment) { prefabDestinationAlignment = null; } } } GUILayout.BeginVertical(GUI.skin.box); { if (isPrefab.HasValue && isPrefab.Value) { EditorGUILayout.LabelField(PrefabLabelContent); } else { EditorGUILayout.LabelField(RaySnappingLabelContent); TooltipUtility.SetToolTip(RaySnappingBehaviourTooltip); } EditorGUI.indentLevel++; { if (isPrefab.HasValue && isPrefab.Value) { EditorGUI.showMixedValue = !prefabBehaviour.HasValue; var prefabBehavour = prefabBehaviour.HasValue ? prefabBehaviour.Value : PrefabInstantiateBehaviour.Reference; EditorGUI.BeginChangeCheck(); { prefabBehavour = (PrefabInstantiateBehaviour)EditorGUILayout.EnumPopup(PrefabInstantiateBehaviourContent, prefabBehavour); TooltipUtility.SetToolTip(PrefabInstantiateBehaviourTooltip); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(targetNodes, "Changed CSG operation of nodes"); for (int i = 0; i < targetNodes.Length; i++) { targetNodes[i].PrefabBehaviour = prefabBehavour; } } EditorGUI.showMixedValue = false; } EditorGUI.showMixedValue = !prefabDestinationAlignment.HasValue; var destinationAlignment = prefabDestinationAlignment.HasValue ? prefabDestinationAlignment.Value : PrefabDestinationAlignment.AlignToSurface; EditorGUI.BeginChangeCheck(); { destinationAlignment = (PrefabDestinationAlignment)EditorGUILayout.EnumPopup(DestinationAlignmentContent, destinationAlignment); TooltipUtility.SetToolTip(DestinationAlignmentTooltip); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(targetNodes, "Changed CSG operation of nodes"); for (int i = 0; i < targetNodes.Length; i++) { targetNodes[i].PrefabDestinationAlignment = destinationAlignment; } } EditorGUI.showMixedValue = false; EditorGUI.showMixedValue = !prefabSourceAlignment.HasValue; var sourceAlignment = prefabSourceAlignment.HasValue ? prefabSourceAlignment.Value : PrefabSourceAlignment.AlignedFront; EditorGUI.BeginChangeCheck(); { sourceAlignment = (PrefabSourceAlignment)EditorGUILayout.EnumPopup(SourceAlignmentContent, sourceAlignment); TooltipUtility.SetToolTip(SourceAlignmentTooltip); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(targetNodes, "Changed CSG operation of nodes"); for (int i = 0; i < targetNodes.Length; i++) { targetNodes[i].PrefabSourceAlignment = sourceAlignment; } } EditorGUI.showMixedValue = false; } EditorGUI.indentLevel--; } GUILayout.EndVertical(); GUILayout.Space(10); if (targetModels.Length == 0) { int invalidOperationType = 999; bool? handleAsOne = null; bool selMixedValues = false; CSGOperationType operationType = (CSGOperationType)invalidOperationType; bool opMixedValues = false; if (targetBrushes.Length > 0) { operationType = targetBrushes[0].OperationType; } for (int b = 1; b < targetBrushes.Length; b++) { var brush = targetBrushes[b]; if (operationType != brush.OperationType) { opMixedValues = true; } } foreach (var operation in targetOperations) { if (operationType == (CSGOperationType)invalidOperationType) { operationType = operation.OperationType; } else if (operationType != operation.OperationType) { opMixedValues = true; } if (!handleAsOne.HasValue) { handleAsOne = operation.HandleAsOne; } else if (handleAsOne.Value != operation.HandleAsOne) { selMixedValues = true; } } GUILayout.BeginVertical(GUI.skin.box); { bool passThroughValue = false; if (targetBrushes.Length == 0 && targetOperations.Length > 0) // only operations { bool?passThrough = targetOperations[0].PassThrough; for (int i = 1; i < targetOperations.Length; i++) { if (passThrough.HasValue && passThrough.Value != targetOperations[i].PassThrough) { passThrough = null; break; } } opMixedValues = !passThrough.HasValue || passThrough.Value; var ptMixedValues = !passThrough.HasValue; passThroughValue = passThrough.HasValue ? passThrough.Value : false; if (CSG_EditorGUIUtility.PassThroughButton(passThroughValue, ptMixedValues)) { Undo.RecordObjects(targetNodes, "Changed CSG operation of nodes"); foreach (var operation in targetOperations) { operation.PassThrough = true; } InternalCSGModelManager.CheckForChanges(); EditorApplication.RepaintHierarchyWindow(); } if (passThroughValue) { operationType = (CSGOperationType)255; } } EditorGUI.BeginChangeCheck(); { operationType = CSG_EditorGUIUtility.ChooseOperation(operationType, opMixedValues); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(targetNodes, "Changed CSG operation of nodes"); foreach (var brush in targetBrushes) { brush.OperationType = operationType; } foreach (var operation in targetOperations) { operation.PassThrough = false; operation.OperationType = operationType; } InternalCSGModelManager.CheckForChanges(); EditorApplication.RepaintHierarchyWindow(); } } GUILayout.EndVertical(); if (targetOperations.Length == 0 && targetModels.Length == 0) { GUILayout.Space(10); if (targetBrushes.Length == 1) { GUILayout.BeginVertical(GUI.skin.box); { EditorGUI.indentLevel++; OpenSurfaces = EditorGUILayout.Foldout(OpenSurfaces, SurfacesContent); EditorGUI.indentLevel--; if (OpenSurfaces) { var targetShape = targetBrushes[0].Shape; var texGens = targetShape.TexGens; var texGenFlagArray = targetShape.TexGenFlags; for (int t = 0; t < texGens.Length; t++) { GUILayout.Space(2); var texGenFlags = texGenFlagArray[t]; var material = targetShape.TexGens[t].RenderMaterial; var physicsMat = targetShape.TexGens[t].PhysicsMaterial; EditorGUI.BeginChangeCheck(); { GUILayout.BeginHorizontal(); { GUILayout.Space(4); material = CSG_EditorGUIUtility.MaterialImage(material); GUILayout.Space(2); GUILayout.BeginVertical(); { //EditorGUI.BeginDisabledGroup(texGenFlags != TexGenFlags.None); { material = EditorGUILayout.ObjectField(material, typeof(Material), true) as Material; } //EditorGUI.EndDisabledGroup(); physicsMat = EditorGUILayout.ObjectField(physicsMat, typeof(PhysicMaterial), true) as PhysicMaterial; texGenFlags = EditModeCommonGUI.OnSurfaceFlagButtons(texGenFlags); } GUILayout.EndVertical(); GUILayout.Space(4); } GUILayout.EndHorizontal(); } if (EditorGUI.EndChangeCheck()) { var selectedBrushSurfaces = new [] { new SelectedBrushSurface(targetBrushes[0], t) }; using (new UndoGroup(selectedBrushSurfaces, "discarding surface")) { texGenFlagArray[t] = texGenFlags; targetShape.TexGens[t].RenderMaterial = material; targetShape.TexGens[t].PhysicsMaterial = physicsMat; } } GUILayout.Space(4); } } } GUILayout.EndVertical(); } } if (handleAsOne.HasValue) { EditorGUI.BeginChangeCheck(); { EditorGUI.showMixedValue = selMixedValues; handleAsOne = EditorGUILayout.Toggle(HandleAsOneLabel, handleAsOne.Value); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(targetNodes, "Changed CSG operation 'Handle as one object'"); foreach (var operation in targetOperations) { operation.HandleAsOne = handleAsOne.Value; } EditorApplication.RepaintHierarchyWindow(); } } } #if false if (targetNodes.Length == 1) { var node = targetNodes[0]; var brush = node as CSGBrush; if (brush != null) { var brush_cache = CSGSceneManager.GetBrushCache(brush); if (brush_cache == null || brush_cache.childData == null || brush_cache.childData.modelTransform == null) { EditorGUILayout.LabelField("brush-cache: null"); } else { EditorGUILayout.LabelField("node-id: " + brush.brushNodeID); } } var operation = node as CSGOperation; if (operation != null) { var operation_cache = CSGSceneManager.GetOperationCache(operation); if (operation_cache == null || operation_cache.childData == null || operation_cache.childData.modelTransform == null) { EditorGUILayout.LabelField("operation-cache: null"); } else { EditorGUILayout.LabelField("operation-id: " + operation.operationNodeID); } } var model = node as CSGModel; if (model != null) { var model_cache = CSGSceneManager.GetModelCache(model); if (model_cache == null || model_cache.meshContainer == null) { EditorGUILayout.LabelField("model-cache: null"); } else { EditorGUILayout.LabelField("model-id: " + model.modelNodeID); } } } #endif } finally { TooltipUtility.DrawToolTip(getLastRect: true, goUp: true); } }
static void OnScene(SceneView sceneView) { if (!RealtimeCSG.CSGSettings.EnableRealtimeCSG) { return; } UpdateOnSceneChange(); if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } if (Event.current.type == EventType.Repaint && !ColorSettings.isInitialized) { ColorSettings.Update(); } if (!IsActive()) { ResetUpdateRoutine(); } if (Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag) { mousePressed = true; } else if (Event.current.type == EventType.MouseUp || Event.current.type == EventType.MouseMove) { mousePressed = false; } var s_RectSelectionID_instance = (int)s_RectSelectionID_field.GetValue(null); UpdateRectSelection(sceneView, s_RectSelectionID_instance); OnHandleDragAndDrop(inSceneView: true); var eventType = Event.current.GetTypeForControl(s_RectSelectionID_instance); var hotControl = GUIUtility.hotControl; if (hotControl == s_RectSelectionID_instance && CSGBrushEditorManager.ActiveTool.IgnoreUnityRect) { hotControl = 0; GUIUtility.hotControl = 0; } switch (eventType) { case EventType.MouseDown: { rectClickDown = (Event.current.button == 0 && hotControl == s_RectSelectionID_instance); clickMousePosition = Event.current.mousePosition; mouseDragged = false; break; } case EventType.MouseUp: { rectClickDown = false; break; } case EventType.MouseMove: { rectClickDown = false; break; } case EventType.Used: { if (clickMousePosition != Event.current.mousePosition) { mouseDragged = true; } if (!mouseDragged && rectClickDown && Event.current.button == 0) { // m_RectSelection field of SceneView var m_RectSelection_instance = m_RectSelection_field.GetValue(sceneView); var m_RectSelecting_instance = (bool)m_RectSelecting_field.GetValue(m_RectSelection_instance); if (!m_RectSelecting_instance) { // make sure GeneratedMeshes are not part of our selection if (Selection.gameObjects != null) { var selectedObjects = Selection.objects; var foundObjects = new List <UnityEngine.Object>(); foreach (var obj in selectedObjects) { var component = obj as Component; var gameObject = obj as GameObject; var transform = obj as Transform; if (!(component && component.GetComponent <GeneratedMeshes>()) && !(gameObject && gameObject.GetComponent <GeneratedMeshes>()) && !(transform && transform.GetComponent <Transform>())) { foundObjects.Add(obj); } } if (foundObjects.Count != selectedObjects.Length) { Selection.objects = foundObjects.ToArray(); } } SelectionUtility.DoSelectionClick(); Event.current.Use(); } } rectClickDown = false; break; } case EventType.ValidateCommand: { if (Event.current.commandName == "SelectAll") { Event.current.Use(); break; } if (Keys.HandleSceneValidate(CSGBrushEditorManager.CurrentTool, true)) { Event.current.Use(); HandleUtility.Repaint(); } break; } case EventType.ExecuteCommand: { if (Event.current.commandName == "SelectAll") { var transforms = new List <UnityEngine.Object>(); for (int sceneIndex = 0; sceneIndex < SceneManager.sceneCount; sceneIndex++) { var scene = SceneManager.GetSceneAt(sceneIndex); foreach (var gameObject in scene.GetRootGameObjects()) { foreach (var transform in gameObject.GetComponentsInChildren <Transform>()) { if ((transform.hideFlags & (HideFlags.NotEditable | HideFlags.HideInHierarchy)) == (HideFlags.NotEditable | HideFlags.HideInHierarchy)) { continue; } transforms.Add(transform.gameObject); } } } Selection.objects = transforms.ToArray(); Event.current.Use(); break; } break; } case EventType.KeyDown: { if (Keys.HandleSceneKeyDown(CSGBrushEditorManager.CurrentTool, true)) { Event.current.Use(); HandleUtility.Repaint(); } break; } case EventType.KeyUp: { if (Keys.HandleSceneKeyUp(CSGBrushEditorManager.CurrentTool, true)) { Event.current.Use(); HandleUtility.Repaint(); } break; } case EventType.Layout: { if (currentDragTool != null) { currentDragTool.Layout(); } break; } case EventType.Repaint: { break; } } //bool fallbackGUI = EditorWindow.focusedWindow != sceneView; //fallbackGUI = CSGBrushEditorManager.InitSceneGUI(sceneView); // || fallbackGUI; //fallbackGUI = true; /* * if (SceneQueryUtility._deepClickIntersections != null && * SceneQueryUtility._deepClickIntersections.Length > 0) * { * foreach (var intersection in SceneQueryUtility._deepClickIntersections) * { * var triangle = intersection.triangle; * Debug.DrawLine(triangle[0], triangle[1]); * Debug.DrawLine(triangle[1], triangle[2]); * Debug.DrawLine(triangle[2], triangle[0]); * } * } */ if (Event.current.type == EventType.Repaint) { MeshInstanceManager.RenderHelperSurfaces(sceneView); } if (Event.current.type == EventType.Repaint) { if (currentDragTool != null) { currentDragTool.OnPaint(); } SceneTools.OnPaint(sceneView); } else //if (fallbackGUI) { BottomBarGUI.ShowGUI(sceneView); } CSGBrushEditorManager.OnSceneGUI(sceneView); //if (fallbackGUI) { TooltipUtility.InitToolTip(sceneView); if (Event.current.type == EventType.Repaint) { BottomBarGUI.ShowGUI(sceneView); } if (!mousePressed) { Handles.BeginGUI(); TooltipUtility.DrawToolTip(getLastRect: false); Handles.EndGUI(); } } }
internal static void OnScene(SceneView sceneView) { if (Event.current.type == EventType.MouseMove) { sceneView.Repaint(); } sceneView.cameraSettings.dynamicClip = false; sceneView.cameraSettings.easingEnabled = false; sceneView.cameraSettings.accelerationEnabled = false; //if (sceneView.orthographic) //{ // sceneView.camera.nearClipPlane = 1; // sceneView.camera.farClipPlane = 1001f; // var camPos = sceneView.pivot; // var camForward = sceneView.camera.transform.forward; // for (int i = 0; i < 3; i++) // { // if (!FastApproximately(camForward[i], 0, .01f)) // { // camPos[i] = 1000; // } // } // sceneView.pivot = camPos; //} if (sceneView.orthographic) { if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.F) { Event.current.Use(); sceneView.pivot = Vector3.zero; if (TryGetSelectionBounds(out Bounds bounds)) { var sz = bounds.extents.magnitude; sz = Mathf.Clamp(sz, 0.05f, 500); sceneView.pivot = bounds.center; sceneView.size = sz; } } if (sceneView.size > 500) { sceneView.size = 500; } if (sceneView.size < .05f) { sceneView.size = .05f; } } CSGSettings.RegisterSceneView(sceneView); if (!RealtimeCSG.CSGSettings.EnableRealtimeCSG || EditorApplication.isPlayingOrWillChangePlaymode) { return; } UpdateLoop.UpdateOnSceneChange(); if (!RealtimeCSG.CSGSettings.EnableRealtimeCSG) { ColorSettings.isInitialized = false; } else if (!ColorSettings.isInitialized) { if (Event.current.type == EventType.Repaint) { ColorSettings.Update(); } } if (!UpdateLoop.IsActive()) { UpdateLoop.ResetUpdateRoutine(); } if (Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag) { mousePressed = true; } else if (Event.current.type == EventType.MouseUp || Event.current.type == EventType.MouseMove) { mousePressed = false; } SceneDragToolManager.OnHandleDragAndDrop(sceneView); RectangleSelectionManager.Update(sceneView); EditModeManager.InitSceneGUI(sceneView); if (Event.current.type == EventType.Repaint) { MeshInstanceManager.UpdateHelperSurfaces(); SceneToolRenderer.OnPaint(sceneView); } else { SceneViewBottomBarGUI.ShowGUI(sceneView); SceneViewInfoGUI.DrawInfoGUI(sceneView); } //if(EditorWindow.mouseOverWindow == sceneView) { EditModeManager.OnSceneGUI(sceneView); TooltipUtility.InitToolTip(sceneView); if (!mousePressed) { Handles.BeginGUI(); TooltipUtility.DrawToolTip(getLastRect: false); Handles.EndGUI(); } if (Event.current.type == EventType.Layout) { var currentFocusControl = CSGHandles.FocusControl; if (prevFocusControl != currentFocusControl) { prevFocusControl = currentFocusControl; HandleUtility.Repaint(); } } } }