- Home /
Mecanim Animation won't stop looping.
Hello, I have set up a walk/run cycle for a Character that I am playing with. I am having an issue where on touch input the Mecanim transition will take place (playing the animation) but the animation will not stop looping, but it will transition back to the Walk/Run start for 20 frames and loop back into the animation. But if I touch the screen again the animation will stop playing and return to the walk/run state of the Mecanim animation.
I was wondering whether I was using the wrong touch input, I am using this:
//Touch Input Jump
foreach (Touch touch in Input.touches)
{
if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
{
or there was something wrong with the way I have setup the Mecanim.
Add more parameters in the state machine.
$$anonymous$$ake a default state with either an idle animation or leave it empty and make sure there is a solid parameter to transition away from the default state. Also check out Exit Time parameter.
This is how I currently have the animator set out. I edited it to fit with what you have said but it is still causing the issue!
these are 2 screen shots of what I have currently. Screen Shots
please point out if I am overlooking something simple (very likely).
Change the loop condition on the import tab after clicking the model or anims prefab.
I only see an exit time parameter under the transition you have clicked on. You have parameters speed and jump but if you dont enter it under conditions for the transition they dont do anything.
Click each transition arrow and add conditions as appropriate under 'Conditions'.
Thanks for the reply I will have a go with that now cheers.
I tried everything you said might fix it but after no success. I don't know what to do is there some other way of animating characters?
Answer by torak289 · Dec 12, 2014 at 02:28 PM
I managed to fix the issue with the looping animation. I had put the else statement in the script in the wrong location in association with the touch input, but as soon s I had fixed that everything started to work like a dream.
Your answer
![](https://koobas.hobune.stream/wayback/20220613173733im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
My Unity game randomly freezes with no error or warnings, HALP? 2 Answers
Can I make animations snap to a frame? 1 Answer
How to create new animations for the built-in character 1 Answer
if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.LeftShift)) with , PlayMode.StopAll);???? 1 Answer
Humanoid Rig breaking animations that work fine as Generic 5 Answers