Button Flickering On and Off When Pressed
I have recently opened a project that I haven't done anything for a while, but I can assure you that this was not a problem when I stopped a few months ago.
When I press a button, it quickly changes from its pressed state to its normal state extremely quickly, even though I only pressed the button once, as well as executing the function every time. It doesn't stop doing this until I click somewhere on the screen that isn't the button.
I have tried making new buttons, and they behave the same way.
Here is a video exhibiting the odd behavior
I am on version 2020.1.17f1
Answer by CapClumsy · Jul 02, 2021 at 02:19 PM
Well, while playing around with the button settings, I discovered that if I changed the Navigation
parameter of the Button
component from Automatic
to None
it fixed the issue.
I'm still confused why it happened though, since I didn't make any changes from when I last opened it.
Answer by lvskiprof · Jul 01, 2021 at 07:59 PM
Maybe if you could show the button in the Inspector it would help us. It looks like something is triggering repeatedly once you click on it. So looking at your OnClick() method for the button might be a good start.
Nothing happens to the button in the inspector, and I tried making completely new buttons that had no OnClick()
methods at all and the same thing happened.
I meant show us what it shows you in the Inspector, so we can see how it is configured. Interesting that a new button also shows the same issue. I have not seen that before.