コード例 #1
0
        public void SetCursor(Cursor cursor)
        {
            if (GUIView.current == null)
            {
                // Cannot set the cursor if the current view is null.
                return;
            }

            if (cursor.texture != null)
            {
                EditorGUIUtility.SetCurrentViewCursor(cursor.texture, cursor.hotspot, MouseCursor.CustomCursor);
            }
            else
            {
                var mouseCursor = (MouseCursor)cursor.defaultCursorId;
                if (mouseCursor == MouseCursor.Arrow)
                {
                    // If it's the default cursor reset the cursor state
                    // so that editor cursor rects can be processed
                    EditorGUIUtility.ClearCurrentViewCursor();
                }
                else
                {
                    EditorGUIUtility.SetCurrentViewCursor(null, Vector2.zero, mouseCursor);
                }
            }
        }
コード例 #2
0
 public void ResetCursor()
 {
     if (GUIView.current == null)
     {
         // Cannot clear the cursor if the current view is null.
         return;
     }
     EditorGUIUtility.ClearCurrentViewCursor();
 }
コード例 #3
0
        public static void ClearCursor()
        {
            if (!s_CurrentCursor.HasValue)
            {
                return;
            }

            EditorGUIUtility.ClearCurrentViewCursor();
            s_CurrentCursor = null;
        }
コード例 #4
0
 public void ResetCursor()
 {
     EditorGUIUtility.ClearCurrentViewCursor();
 }