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 /
avatar image
6
Question by matthewse19 · Dec 05, 2016 at 07:29 AM · animationanimatortransitiontransitions

unwanted delay between animations

I am trying to transition from one animation to a second animation, but it seems that the transition is reading the variable fast enough. My first animation will play once, and waits until the condition is true to move onto the next animation. However, once I set the necessary bool to true, there is a slight delay when going into the next animation.

Here's some of the code that I'm using: public class bowLogic : MonoBehaviour { Animator ac;

     int clickDown;
     // Use this for initialization
     void Start () {
         ac = GetComponent<Animator> ();
 
         clickDown = Animator.StringToHash ("clickDown");
     }
     
     // Update is called once per frame
     void Update () {
         if (Input.GetMouseButton (0)) {
             ac.SetBool (clickDown, true);
         }
 
 
         if (Input.GetMouseButtonUp (0)) {
             ac.SetBool (clickDown, false);
         }
             
     }
 

Once the mouse is held down I want it to transition to the second animation once the first one is done. The transition is instant when you hold down the mouse during the first animation, but if the first animation is done playing and is waiting on the last frame, clicking the button doesn't instantly transition but holding it for a few tenths of a second does.

Comment
Add comment · Show 2
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 matthewse19 · Dec 03, 2016 at 09:47 PM 0
Share

$$anonymous$$y hypothesis is that even though the first animation isn't looping, there' still some internal timer that's looping and only at the end of the loop does the transition check if the bool is true. Not sure if I explained that right or if it makes sense but it's a shot.

avatar image Cherno · Dec 05, 2016 at 01:03 PM 0
Share

$$anonymous$$aybe the problem lies with the exit time settings of the transitions?

5 Replies

· Add your reply
  • Sort: 
avatar image
30

Answer by iAmAwsum · Dec 05, 2016 at 03:04 PM

In the animator window select an arrow : alt text

then in the inspector window make sure to untick "Has Exit Time", "Fixed Duration" and set "Transition Duration(%)" to 0, like so :

alt text


820ecd9dedcb93ba5d3ddea2ea00d7de.png (11.3 kB)
f977253613f70c89aec9bcce9e9299ef.png (16.8 kB)
Comment
Add comment · Show 3 · 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 $$anonymous$$ · Dec 26, 2017 at 04:26 PM 0
Share

Also untick "Can Transition To Self"

avatar image unity_0zIuZSdUTMjRTA · Sep 11, 2019 at 08:21 PM 0
Share

This prevents the animation from playing at all, it'll just be stuck on the first frame permanently.

avatar image mpbMKE · Jan 18, 2020 at 08:31 PM 0
Share

Awesome, this is exactly what I needed.

avatar image
5

Answer by Shrikky23 · Dec 05, 2016 at 03:53 PM

In the animator controller, select the transition and make the Transition duration 0.

Also there are chances that you are in a coroutine or it is waiting to finish the previous animation (uncheck has exit time in the previous animation, if you want instant change of animation)

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
3

Answer by unity_N7zkzSHCoLdMLg · Aug 31, 2020 at 10:33 PM

Just adding this for future searchers. Another reason could be the order your transitions are in. In the state drag the transition with higher priority up to the top.

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 stiverm · Jan 03, 2021 at 10:59 PM 0
Share

This worked in my case. I was getting some rather ugly transitional behavior conditionally. You deserve a hero cookie... or at least an upvote.

avatar image
2

Answer by Paricus · Dec 05, 2016 at 02:19 PM

have you checked exit times in the transitions on the animator controller?

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 Rispat-Momit · Jan 30 at 04:33 AM 0
Share

I keep forgetting that exit time set to zero means no transition.

avatar image
0

Answer by pythongeko · Feb 24, 2021 at 01:23 AM

Thx so much!!!! I spent around 5 hours on this.

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

15 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

Related Questions

Smooth transition with Animator.Play or similar? 2 Answers

Animator won't let me add transitions 1 Answer

Create animation transitions via script. 0 Answers

Animator animation transition twitch at the start 1 Answer

How to stop mesh disappearing during Animator state transition blend time? 1 Answer


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