Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Animator Instant transition after trigger condition is true on non-loop animation

Discussion in 'Animation' started by Hellwaiker, Oct 12, 2018.

  1. Hellwaiker


    Jan 8, 2016
    So I have this case:
    Animation 1 (Non-Loop): moves cube on X axis by 3 in 5 seconds.
    Animation 1 (Non-Loop): rotates cube on Y axis by 190 degrees over 1 second. (and starts on X pos at 3)
    Bool variable called Test

    I have a transition between animation 1 and animation 2, it's transition condition is set to trigger if my bool variable is false.

    What I want to achieve, Stage 1 plays fully and then if bool is false animation immediately transitions to Stage 2.

    Case 1:
    If I set exit time to 0 and fixed duration to 0 and false, this does not work for me as animation Stage1 can be interrupted before it plays fully. But transitions are instant.
    Case 2:
    I set exit time to 1 fixed duration to 0 and false, now animation will not interrupt until it plays fully, BUT once it has already played and is at hold, if I trigger transition with bool variable. What happens is animator will wait full 5 seconds (length of stage 1 animation) and only then transition to Stage 2 animation.

    How do I solve this within inspector so It both waits for animation for finish, but once it has finished and trigger is true it transitions immediately?

    I know I can use 1 frame Stage 1 End pose between them, and I know I can use script to check Stage 1 progress with a script before trigger a bool. I'm hoping for a cleaner solution.


    BTW here is the sample scene (no other assets) with setup I mentions. Cube and two animations: