- Home /
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.
P.S. Door have Animation component.
Answer by Chimer0s · Feb 09, 2019 at 11:17 PM
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.
Your answer
Follow this Question
Related Questions
3d Animated Jump Script 0 Answers
Animator transition help 0 Answers
C#: Climb ledge while inside collider 1 Answer
Efficient way to instantiate a sprite that plays an animation then destroys itself? (3d space) 1 Answer
Character Wont Stop Moving 1 Answer