Search Unity

  1. Unity 2018.3 is now released.
    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. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  6. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  7. 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

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    45
    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