Search Unity

In Custom Editor, After Event.Use(), how to get state of mouse input ?

Discussion in 'Editor & General Support' started by usernameHed, Nov 24, 2019.

  1. usernameHed

    usernameHed

    Joined:
    Apr 5, 2016
    Posts:
    93
    Hello, I am doing a simple Resizing function in an editorWindow:
    Code (CSharp):
    1. if (Event.current.type == EventType.MouseDown)
    2. {
    3.      isResizing = true;
    4. }
    5. if (isResizing && Event.current.type == EventType.MouseDrag)
    6. {
    7.         //
    8. }
    9. if (isResizing && Event.current.type == EventType.MouseUp)
    10. {
    11.          isResizing = false;
    12. }
    It works well, except one bug:
    If I start to resize, and then, when I am still holding, I leave the editorWindow with my mouse, if I release the button, nothing happen.

    But when I come back to my editorWindow with my mouse: the code is still at isResizing = true

    How can I resolve this little bug ?

    Thanks !