- Home /
How do I get my UI Button to play my "fire animation" once?
I have a ninja in my scene and I have a "fire" button. I want to click on the button and have him fire once. the projectile fires once as does the sound clip, but the animation plays once and then stays. Basically the problem is that I have a bool attached to my animation. I can only get the "on click function" to set the bool to "true" but i cant set it back to "false" thereafter.
Answer by EvanCheddar · Mar 23, 2018 at 01:06 AM
I figured it out. What I was looking for and needed were EVENT TRIGGERS!!!!! omg so simple!
Answer by Cornelis-de-Jager · Mar 22, 2018 at 10:23 PM
Don't use a bool. Instead, use a trigger for the animation. The triggers work just like a bool, except once the animation starts playing its set to false.
Have a look at this page:
@Cornelis-de-Jager So I just tried this, and what it does is that every time the button is clicked it goes on and then off again (takes 2 clicks to get it to turn off) I need the animation to play on and off from the same click. Does that make sense? Any idea how to achieve this with the trigger?
Your answer
Follow this Question
Related Questions
Right Mouse Click in Android 2 Answers
Touch GUI texture to toogle animation 0 Answers
Using one animation on multiple objects? 1 Answer
Buttons and Touch area issue on android 0 Answers