I’m trying to move a cube while I left click on a button.
I could achieve that with a simple combination of Pointer Down/Pointer Up with a boolean… but as I have a tons of buttons I would like to simply my code.
So I found that launching my moveCube() function throught an “Update Selected” Event Trigger is working very well.
Then you can stop the loop by clicking once again somewhere else.
But how to stop it with a “Pointer Up” ?
I found a dirty solution (i don’t even understand why it’s working) , but I would like a cleaner one
Maybe if you shared this code people could comment on the code. I’d love you to share it because I’m trying to add a pointerDown and pointerUp event to a button and can’t find an example.
Setting eventData.selectedObject to null in any handler method (e.g. IPointerUpHandler.OnPointerUp) will unselect the object and the OnUpdateSelected method won’t be called anymore (until you make another mouse click / mouse down).