Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 /
avatar image
1
Question by B17 Games · Jul 27, 2015 at 04:33 AM · animationjavascript

2D animation problems: Sprite wants to finish first animation before moving to the next

I am animating a 2D escapists sprite which works ok. By pressing the arrow keys or wasd you go in the direction you want and the animation points in that direction but the thing is, it wants to wait for the last animation to finish before moving onto the next one when you press the key causing a randomly timed delay.

It would be great if you could give me a solution.

here is the animation script and I have also attached a picture of the animator:

pragma strict

public var anim : Animator ;

function Start () {

 anim = GetComponent("Animator");

}

function Update () {

 if(Input.GetKeyDown(KeyCode.A)|| Input.GetKey(KeyCode.LeftArrow)){
     anim.SetBool("Left",true);
     anim.SetBool("Right",false);
     anim.SetBool("Up",false);
     anim.SetBool("Down",false);
 }
 {

 if(Input.GetKeyDown(KeyCode.D)|| Input.GetKey(KeyCode.RightArrow)){
     anim.SetBool("Right",true);
     anim.SetBool("Left",false);
     anim.SetBool("Up",false);
     anim.SetBool("Down",false);
 }
 {

 if(Input.GetKeyDown(KeyCode.W)|| Input.GetKey(KeyCode.UpArrow)){
     anim.SetBool("Up",true);
     anim.SetBool("Right",false);
     anim.SetBool("Left",false);
     anim.SetBool("Down",false);
 }
 {

 if(Input.GetKeyDown(KeyCode.S)|| Input.GetKey(KeyCode.DownArrow)){
     anim.SetBool("Down",true);
     anim.SetBool("Right",false);
     anim.SetBool("Up",false);
     anim.SetBool("Left",false);
 }
 }

} } }

alt text

help.png (100.2 kB)
Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by allenallenallen · Jul 27, 2015 at 05:14 AM

Remove the Exit Time for the all of the animations in the Animator. This way, you can interrupt them with a press of a button to go onto the next state.

Comment
Add comment · 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
1

Answer by HDNua · Jul 27, 2015 at 10:22 AM

  1. Move to animator window.

  2. Click transition line.

  3. Change the value of Exit Time equal to 0

Here's picture that helps you.

alt text


제목-없음.png (185.8 kB)
Comment
Add comment · 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
0

Answer by nadhimali · Jul 27, 2015 at 07:21 AM

Click on the transition line and Make sure that exit time and all sub times are zeros to get a direct animation switching.

Comment
Add comment · 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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

how character's legs(tps) move? 0 Answers

How would you make a shapeshifting mechanic in a game? 1 Answer

How to fix Animation 1 Answer

Help with attacking, and death animation. Unity 5 javascript 1 Answer

Changing number of frames in uvAnimationTileX 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