Im trying to make my Walk animation Loop correctly.
My animation correctly works in preview but when I do it in the game tab, it goes 3/4 of the way through the cycle then loops instead of waiting for the animation to completely finish then loop.
Here’s my script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class player : MonoBehaviour {
public Animator anim;
// Use this for initialization
void Start () {
anim = GetComponent<Animator> ();
}
// Update is called once per frame
void Update () {
if (Input.GetKey ("w")) {
anim.Play("walk01");
}
if(Input.GetKeyDown ("space")){
anim.Play("jump01");
}
}
}
I tried you first two suggestions, I haven’t made a transition from idle01 to jump01 because then the idle animation automatically goes to jump randomly when I don’t want it to, I realize that maybe I didnt explain the problem well enough, heres a 10 second video 3:4walkglitch.mov - Google Drive
In the video it correctly plays the animation, but halfway through it loops instead of waiting till the animation finishes then looping, thanks for any help, thanks for the suggestions @paincide
Is the transition from the animator state “walk01” to “idle01” set to automatically trigger after some given time? Because in this case the line “anim.Play(“walk01”);” would reset the animation to the start afterwards. It looks like that because in your movie the idle animation seems to be playing for a frame.