Search Unity

Complete a looping animation before transition

Discussion in 'Animation' started by VoodooDetective, Aug 1, 2020.

  1. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    How do I complete a looping animation before transitioning? I want it to loop for an indefinite number of times. Randomly, I'll say "CrossFade" and I want to finish the current loop cycle before moving to the next animation.

    HOW do I do that?

    "crossfade after animation completes"
     
  2. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    I might need to do this a lot in my 2D (traditional animation) game so bloating the controller with a million bools or triggers is no good.
     
  3. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
  4. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
  5. the_0dium

    the_0dium

    Joined:
    Nov 29, 2018
    Posts:
    15
    Check "has exit time"
     
  6. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    @dibdab
    So I've got to busy wait or sleep until the animation is over? There's no build in method to queue up an animation after a loop ends?

    @the_0dium
    Has exit time will exit after the first loop unless I use trigger/bool for every single instance of these transitions which won't work since I might have a lot of them.
     
  7. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    Sounds like it's not possible with the Animator.
     
  8. the_0dium

    the_0dium

    Joined:
    Nov 29, 2018
    Posts:
    15
    @the_0dium
    Has exit time will exit after the first loop unless I use trigger/bool for every single instance of these transitions which won't work since I might have a lot of them.[/QUOTE]
    How do you expect to create transitions without using bools for them then?
     
  9. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    I often use Play or Crossfade. I was hoping I could use Crossfade with a parameter to specify that it should wait for the current loop iteration to finish. Better yet, the original animation component had a queue animation. That'd do it too. Neither of those are options with Animator so it's just not possible. You have busy wait or bloat up your controller with a bunch of variables.
     
  10. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Are you telling me that Animator Controllers become a hacky mess when trying to implement even simple logic like waiting for an animation to end?
     
    E-wan15 and nitrox945 like this.