Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


MouseCursor

Custom mouse cursor shapes used with EditorGUIUtility.AddCursorRect.
Read time 2 minutesLast updated 4 days ago

Definition

  • Type: Enum
  • Namespace: UnityEditor
  • Assembly: UnityEditor
public enum MouseCursor

Examples

//Create a folder and name it “Editor” if this doesn’t already exist//Put this script in the folder//This script creates a new menu (“Examples”) and a menu item (“Mouse Cursor”). Click on this option. This displays a small window that has a color box in it.//Hover over the colored box to cause an Orbit mouse cursor to appear.using UnityEngine;using UnityEditor;public class MouseCursorExample : EditorWindow{ [MenuItem("Examples/MouseCursorRect Example")] static void AddCursorRectExample() { MouseCursorExample window = EditorWindow.GetWindowWithRect<MouseCursorExample>(new Rect(0, 0, 180, 80)); window.Show(); } void OnGUI() { EditorGUI.DrawRect(new Rect(10, 10, 160, 60), new Color(0.5f, 0.5f, 0.85f)); EditorGUI.DrawRect(new Rect(20, 20, 140, 40), new Color(0.9f, 0.9f, 0.9f)); EditorGUIUtility.AddCursorRect(new Rect(20, 20, 140, 40), MouseCursor.Orbit); }}

Fields

Value

Description

ArrowNormal pointer arrow.
ArrowMinusArrow with the minus symbol next to it.
ArrowPlusArrow with the plus symbol next to it.
CustomCursorThe current user defined cursor.
FPSCursor with an eye and stylized arrow keys for FPS navigation.
LinkArrow with a Link badge (for assigning pointers).
MoveArrowArrow with the move symbol next to it for the sceneview.
OrbitCursor with an eye for orbit.
PanCursor with a dragging hand for pan.
ResizeHorizontalHorizontal resize arrows.
ResizeUpLeftResize up-Left for window edges.
ResizeUpRightResize up-right for window edges.
ResizeVerticalVertical resize arrows.
RotateArrowArrow with the rotate symbol next to it for the sceneview.
ScaleArrowArrow with the scale symbol next to it for the sceneview.
SlideArrowArrow with small arrows for indicating sliding at number fields.
SplitResizeLeftRightLeft-Right resize arrows for window splitters.
SplitResizeUpDownUp-Down resize arrows for window splitters.
TextText cursor.
ZoomCursor with a magnifying glass for zoom.