How do I setup an animation to be triggered, then loop until triggered again?

Really struggling with this. UE4’s animation pipeline is horribly convoluted for simple stuff, IMHO.

Basically:

I have a skeletal mesh, with some rigid bodies moving around. I have two animation clips - an intro clip, and a loop. I need to play the intro via a triggering event (be it a keypress, onBeginPlay etc etc), then continue to loop until the even is re-triggered.

How would I go about doing this?

There are a few ways to achieve this I think. Here’s some ideas:

  1. With an animation Montage. There’s built-in functionality in Montage to have looping and non-looping sections and you have the ability via Blueprint to jump to a specific section in a Montage. Detailed info here: [LINK][1].

  2. With a bit of logic in an AnimBP state machine. You could have a looping state and a non-looping intro state that can transition back and forth between one another. The transition from the intro to the looping state could be fired whenever the intro anim ends, and the transition from the looping anim back to the intro could be fired by your triggering event. More info on state machines and how they work: [LINK][2].

  3. Lastly, if your skelMesh doesn’t have an AnimBP, you can set the Animation Mode in your Skeletal Mesh Component to ‘Use Animation Asset’ (then slotting in your looping anim). Like so:

Then, control the logic of switching back and forth between your intro and looping anims in the mesh’s corresponding EventGraph (dragging off of the skeletal mesh and using nodes like ‘Play Animation’). As an animator, this is probably not the method that I would go with because there’s a lot of functionality built into Montages and State Machines that you won’t be able to take advantage of here.

Good luck!

I’m having a similar issue using anim sequences triggered in the level blueprint rather than a montage. I plan to create a full AnimBP later but for prototyping purposes, triggering anim sequences in the level bp is a lot easier.
My issue is that on one trigger, I set the animation of the character to play a cinematic, then when the cinematic finishes, I set a looping animation. Then when the player walks through the next trigger, I set a new looping animation. The problem is that this new looping animation doesn’t loop. It seems to be overridden by the previously set looping animation so when it finishes playing once, it jumps back to the last looping animation.

To make this more clear the animations are “greeting”, “endloop” and “idleloop”.
I play “greeting” then “endloop” on the first trigger and then “idleloop” on the second trigger but “idleloop” doesn’t actually loop, it simply plays once and then goes back into playing “endloop”. How do I tell “endloop” to stop looping? I tried promoting the looping bool to a variable and setting this to false before playing "idleloop"and I also tried to play the “endloop” animation again before the “idleloop” and setting its looping state to false hoping it might reset its own state but its still stuck looping. Is there an option to clear all animation from a mesh before calling a new one?