2D Animation Delay
Hey peeps.
So I started working on a new 2D game, and everything was fine until now. It seems to be a rather easy-to-fix problem, however I have no idea what to do. The problem is as follows - When moving my character, the animations are slightly delayed. How do I fix that?
Here's a video of the problem:
https://www.youtube.com/watch?v=mwEcssNSeFc&feature=youtu.be
Here's my code:
 using UnityEngine;
 using System.Collections;
 
 public class PlayerMovement : MonoBehaviour {
 
     Animator anim;
 
     // Use this for initialization
     void Start () {
 
         anim = GetComponent<Animator> ();
 
     }
     
     // Update is called once per frame
     void Update () {
     
         float input_x = Input.GetAxisRaw ("Horizontal");
         float input_y = Input.GetAxisRaw ("Vertical");
 
         bool isWalking = (Mathf.Abs (input_x) + Mathf.Abs (input_y)) > 0;
 
         anim.SetBool ("isWalking", isWalking);
         if (isWalking) 
         {
             anim.SetFloat ("x", input_x);
             anim.SetFloat ("y", input_y);
 
             transform.position += new Vector3 (input_x, input_y, 0).normalized * Time.deltaTime;
         }
 
     }
 }
 
If other suggestions don't work, try looking at the actual animation and/or rearrange it. That was what my problem was.
Answer by Zoogyburger · Feb 09, 2016 at 07:08 PM
So I'm assuming you have an animation controller for your player and have a transition between Idle and Walking. Click on that transition and in the Inspector the will be settings. Grab and drag the blue bar on the timeline all the way to 0:00. If that doesn't work uncheck Has Exit Time.
Just used this recently Feb 4th, 2020. The premise is that it waits for the previous animation to finish so there's a delay for the transition, would might be useful for like attacks where you don't want a player to be able to get out of an attack animation due to it being maybe Souls like and its a risky move.
Answer by jandd661 · Aug 31, 2017 at 08:52 PM
I was having the same problem. This is still a valid solution for 2017. However, there is now a "Transition Duration" input box. I just set this to 0 and cured my problem with 7 of 8 animations.
The other one I found that it started with a single frame from my idle animation. After deleting that key frame, all my issues where solved. Thanks @Zoogyburger ! Oh, this was in a 2D Top Down game.
Your answer
 
 
             Follow this Question
Related Questions
8-way 2D top down movement (diagonal) idle animation issues 0 Answers
Object reference not set to an instance of an object (Unity 2D animation) 1 Answer
Script to animation and movement of 2d player 1 Answer
2D animation transitions and unexpected position changes 2 Answers
Problem with Jump Animation 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                