Move a widget by holding down mouse key and space key


#1

Hey all,
I am trying to move a widget by holding down mouse key and space key at same time, added this interaction with this logic:

It works fine but only for first time, after that it doesnt require space key to move the widget. How can I make it required action for every time?

Thanks


#2

Hi!

Testing whether a key pressed works best when it’s a keyboard message. (OnKeyDown, etc.) You can use the strategy from this post for testing if space is pressed when you are dragging (even though the post was about clicking).


#3

Thanks it worked but I didnt exactly understand second logic. Why second logic is same as first one but make variable false?


#4

Hi!

Because it’s testing for two different messages. The first one is testing for when the key is pressed down, and the second is testing for when the key released.