Triggering animation on click when a key is collected

This is one of my biggest problem in my game.I did animation for opening door, that’s fine, and when is key collected game will set it as true.The problem is when I play the game animation is triggered automatically .What I want is when is key collected and then click on a door to do animation.

Door have Animation component.

If I’m understanding correctly, the issue is that you’re setting the bool to true when the key is collected, not when pressing the button. You’d want a separate bool or variable in the code that detects if the key is collected without it affecting the animator in any way. Then when you press the key, you’ll want to check that variable to make sure the key is collected, and only then set the bool in the animator to true. I may be misunderstanding, though. Seeing how you have the animator set up with a couple of images would be helpful. The code would also be very helpful.