Posts 유니티 에디터 - 마우스 이벤트 메모
Post
Cancel

유니티 에디터 - 마우스 이벤트 메모

Note


  • OnInspectorGUI() 내에서 호출
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
private static bool IsLeftMouseDown => 
    Event.current.type == EventType.MouseDown && Event.current.button == 0;

private static bool IsLeftMouseDrag => 
    Event.current.type == EventType.MouseDrag && Event.current.button == 0;

private static bool IsLeftMouseUp => 
    Event.current.type == EventType.MouseUp && Event.current.button == 0;

private static bool IsRightMouseDown => 
    Event.current.type == EventType.MouseDown && Event.current.button == 1;

private static bool IsRightMouseDrag => 
    Event.current.type == EventType.MouseDrag && Event.current.button == 1;

private static bool IsRightMouseUp => 
    Event.current.type == EventType.MouseUp && Event.current.button == 1;

private static bool IsMouseExitEditor =>
    Event.current.type == EventType.MouseLeaveWindow;

private static Vector2 MousePosition => Event.current.mousePosition;


마우스 커서 변경

1
2
// rect 영역 내에서 손꾸락 모양으로 변경
EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
This post is licensed under CC BY 4.0 by the author.