Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    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. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    44
    Hey,
    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.

    Thanks

    BTW here is the sample scene (no other assets) with setup I mentions. Cube and two animations: https://we.tl/t-yYIy9YGA7d