- Home /
How to reliably check if button is being pressed?
By reliably I mean in a way that it will not fail.
I have a 2 functions that set a bool state to true or false. They are being called PointerDown and PointerUp. But when I run the UI on mobile devices it is very often that the button leaves the boolean to true even when it is not pressed.
This is very hard to simulate on pc/mac, but every now and then when you click on the button rapidly it is left to true.
How to implement similiar feature like isOn with toggles to see if button is being held down and reliably detect when it is released?
Any advice would be greatly appreciated!
Answer by Cromfeli · Jan 08, 2015 at 08:33 AM
I made some further tests and it seems to be editor side visual bug. bool is actally False but the visualization on editor side shows it to be true. I will make bug report out of it. link text
Your answer
![](https://koobas.hobune.stream/wayback/20220613175857im_/https://answers.unity.com/themes/thub/images/avi.jpg)