- Home /
Reset a UI button to a default state when it is disabled
Hi! I have a UI button that when is clicked triggers an animation, and, after a while, I deactivate the button using 'setActive (false)'. But when I activate the button the last animation the button has triggered is still in it, it doesn't come back to the idle state. Firstly I thought about using an 'if' statement that if the button is deactivated it returns to an idle state, but I would like to ask the community if there is some method that resets an object when is deactivated. Thanks!
Answer by DawidNorasDev · Oct 31, 2018 at 02:28 PM
there is no method to 'reset object'. there are ways for 'reset a certain thing'. But still usuwaly you tell it how to 'reset'. So maybe tell the animation to go to first frame, Or reset your fields in class by assigning them default values, you want them to have
Your answer
![](https://koobas.hobune.stream/wayback/20220612181241im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make a button that opens and closes a tab? 1 Answer
NullReferenceExeption on gameObject.SetActive 1 Answer
Playing a button pressed animation on a box 1 Answer
Unity 5 GUI system 1 Answer
click button and not show again 1 Answer