I made a menu but I’m not convinced with the way that the buttons work.
I’m using TouchPhase but I can’t get the propper way to make it work perfectly. I can use TouchPhase.Ended but I can activate the button after moving that touch and I don’t want that. Also I can use TouchPhase.Begin but that can be a miss-touch.
I should make something like onclick but I can’t find a propper way to do it.
Do I need to track that touch checking the phase to make a clean begin-ended? Am I overthinking this too much?
Normally, a click in a button happens when you begin a touch inside the button and also it ends over it.
No problem about what happens in the middle. So you can start a touch in a button, move your finger/mouse over the screen and finally come back to the button before releasing the touch, and it has to be a good click.
Just check where is the touch when it begins… if it is over a button, store it… and when the touch ends, check if it is over the same button. If it is, you have to run your OnPress code.