UnityEditor.SceneView.AddCursorRect C# (CSharp) Method

AddCursorRect() static private method

static private AddCursorRect ( Rect rect, MouseCursor cursor ) : void
rect UnityEngine.Rect
cursor MouseCursor
return void
        internal static void AddCursorRect(Rect rect, MouseCursor cursor)
        {
            if (Event.current.type == EventType.Repaint)
            {
                s_MouseRects.Add(new CursorRect(rect, cursor));
            }
        }

Usage Example

        private void EatMouseInput(Rect position)
        {
            SceneView.AddCursorRect(position, MouseCursor.Arrow);
            int controlId = GUIUtility.GetControlID("SceneViewOverlay".GetHashCode(), FocusType.Native, position);

            switch (Event.current.GetTypeForControl(controlId))
            {
            case EventType.MouseDown:
                if (!position.Contains(Event.current.mousePosition))
                {
                    break;
                }
                GUIUtility.hotControl = controlId;
                Event.current.Use();
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl != controlId)
                {
                    break;
                }
                GUIUtility.hotControl = 0;
                Event.current.Use();
                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl != controlId)
                {
                    break;
                }
                Event.current.Use();
                break;

            case EventType.ScrollWheel:
                if (!position.Contains(Event.current.mousePosition))
                {
                    break;
                }
                Event.current.Use();
                break;
            }
        }
All Usage Examples Of UnityEditor.SceneView::AddCursorRect