Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by jukenis · Feb 09, 2016 at 10:18 AM · animation2dmovementdelay2d animation

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;
         }
 
     }
 }
 
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Guthree · Oct 20, 2020 at 01:39 PM 0
Share

If other suggestions don't work, try looking at the actual animation and/or rearrange it. That was what my problem was.

3 Replies

· Add your reply
  • Sort: 
avatar image
5
Best Answer

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jimmyfnc · Feb 04, 2021 at 09:38 PM 0
Share

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.

avatar image
1

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image crowbarkz · Jul 09, 2018 at 03:05 PM 0
Share

This solved my issue, thanks man!

avatar image
0

Answer by jukenis · Feb 14, 2016 at 06:25 PM

@Zoogyburger Thanks so much, that worked.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Zoogyburger · Feb 15, 2016 at 12:59 AM 0
Share

He He Glad I could help

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

88 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges