Search Unity

Change mouse when holding shift?

Discussion in 'UIElements' started by The-Oddler, May 20, 2019.

  1. The-Oddler

    The-Oddler

    Joined:
    Nov 26, 2010
    Posts:
    103
    I'm making an editor tool that allows for additive selection. Thus when holding shift, you add to your selection, and I want to show a plus sign next to the mouse. I found you can change the cursor with USS to "arrow-plus", however I couldn't find the selector for when the shift-key is held.

    How can I do this?
     
  2. patrickf

    patrickf

    Unity Technologies

    Joined:
    Oct 24, 2016
    Posts:
    44
    If the KeyDownEvent /KeyUpEvent are sent when the shift key is pressed (which I am not sure at all), you can register a callback on these events and check the event keycode.

    Otherwise, I think the best way would be to register a callback for the MouseMoveEvent and then check the event.modifiers for the shift key.