- Home /
Button gets stuck in Pressed state
I have a button on a pop up menu. I wanted the text color of the button to change when the button is pressed, so I used an Animator component to create transition animations for the button's various states. It all works great.
Until...
When the button is pressed, I use SetActive(false) to make the pop up menu invisible. When I later make the pop up menu visible again, the button is still in "Pressed" state, and is stuck there. No amount of hovering, pressing and releasing, or disabling or enabling will change its state. It's stuck in Pressed state.
Any idea how to prevent a button with animated transitions from getting stuck in Pressed state when it is made inactive while in that state? Or how to "un-stick" it once it's stuck?
Answer by Dibbie · Nov 06, 2015 at 08:05 PM
Make sure you reset your buttons state and attributes, so maybe add a onButtonUp event as well, that will reset the color and re-enable the button, and essentially reverse everything your currently doing with its Pressed state.