- Home /
My animation keeps on repeating on my animator
my problem is my animation keeps on repeating on my animator here's the screen shot
okay the problem is when WrongAnswer = true is executed it wont stop playing so what I did is i put another idle so it will go there after playing but if I want to play WrongAnswer again i wont play it because there's no arrow to go back but if i put arrow to go back it will again not stop playing so what should i do i tried many things but i end up to the animation not stoping, what i want is my animation to just play wrong answer once then go back to idle then if a certain confition is applied it will play again only once then go back to being idle again. so how can i do that im trying to figure this out all day and i cant find the answers so please help me thank you, heres a sample code for it
private void HandleAnswer(int answer) {
if (answer == 1)
{
anim.SetBool("WrongAnswer",true);
Attack();
NextQuestion();
}
else {
anim.SetBool("WrongAnswer",false);
{
You only have transitions IN to the Animation states. You must provide Transitions FRO$$anonymous$$ the state also, in order for the State to not become stuck.
if i put another transition from idle 0 to idle it will just circulate and go back to wrong answer again and again im a beginner im sorry
Perhaps have it exit the state to an empty one.
Anyway, its all in the transitions.
yea but if added an empty one there just like this
it will just stop there and wont go back to idle because its empty anyway thanks for trying to help me
Answer by liortal · Aug 06, 2014 at 05:08 PM
You need to go back to the "idle" state, since no transition is configured from the new state you added back to "Wrong Answer".
If you want to trigger a state change, you can use the anim.SetTrigger API instead of setting a bool with a value.
when i go back to idle state it will loop again and go to wrong answer animation and go back to idle and loop again and wont stop forever,
what i need is to loop it once from idle to wrong answer and idle angain then stop,
then again after a certain condition or for example i press a button it will loop again from idle to Wrong answer animation to idle again once more.
can you give me an example im really a beginner and i cant quite understand your answer but thanks for trying
Add more Parameters to your Transitions and trigger them via script.