Search Unity

Looping two animations one after another

Discussion in 'Animation' started by Primoz56, Nov 17, 2019.

  1. Primoz56

    Primoz56

    Joined:
    May 9, 2018
    Posts:
    369
    Hi guys,

    Just wondering if anyone can tell me how to have two animations play in succession in a loop.

    I have animations Attack1 and Attack2. I want to play Attack2 after Attack1 finishes, and then play Attack1 after Attack2 finishes. I'd prefer not to use events if it's possible to do it naturally.

    If i just link the two together, it plays only Attack2 and never Attack1.

    Thanks,
    Primoz
     
  2. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    24
    Just create a transition from Attack1 to Attack2 with no condition and exit time = 1.

    If there's another exit path from Attack1 to some other state, you'll probably have to add a variable and set it as a condition for the transition to Attack2.
     
  3. Primoz56

    Primoz56

    Joined:
    May 9, 2018
    Posts:
    369
    I already have an exit time with 0.69 or close to that, the animation play time. Other paths have variables and such set up.

    I've attached a screenshot of the problem. Attacking is true. If if becomes false the 'other' path is taken which works. The exit time is not being respected. Reverse path back to Attack02 is exactly same configuration as to it.

    Thanks for your time

    upload_2019-11-21_20-59-7.png
     

    Attached Files:

  4. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    24
    First of all, exit time is probably not what you think. A value of 1 equals the whole playback time of the animation. They're not regular time units.

    Then, my guess is that the issue you're having is that the other exit transitions from the two attack states don't enforce the Attacking variable to be false, and you're getting thrown out through those.