Version: 2023.1
LanguageEnglish
  • C#

MouseCursor

enumeration

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Custom mouse cursor shapes used with EditorGUIUtility.AddCursorRect.

//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); } }

Properties

ArrowNormal pointer arrow.
TextText cursor.
ResizeVerticalVertical resize arrows.
ResizeHorizontalHorizontal resize arrows.
LinkArrow with a Link badge (for assigning pointers).
SlideArrowArrow with small arrows for indicating sliding at number fields.
ResizeUpRightResize up-right for window edges.
ResizeUpLeftResize up-Left for window edges.
MoveArrowArrow with the move symbol next to it for the sceneview.
RotateArrowArrow with the rotate symbol next to it for the sceneview.
ScaleArrowArrow with the scale symbol next to it for the sceneview.
ArrowPlusArrow with the plus symbol next to it.
ArrowMinusArrow with the minus symbol next to it.
PanCursor with a dragging hand for pan.
OrbitCursor with an eye for orbit.
ZoomCursor with a magnifying glass for zoom.
FPSCursor with an eye and stylized arrow keys for FPS navigation.
CustomCursorThe current user defined cursor.
SplitResizeUpDownUp-Down resize arrows for window splitters.
SplitResizeLeftRightLeft-Right resize arrows for window splitters.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961