Version: 2020.3
언어: 한국어

MouseCursor

enumeration

매뉴얼로 전환

설명

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

변수

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.