# How to spawn actors with keypress and  play In + Idle (indefinetly) + Out animations?

**URL:** <https://forums.unrealengine.com/t/how-to-spawn-actors-with-keypress-and-play-in-idle-indefinetly-out-animations/476384>\
**Category:** Audio\
**Tags:** Destroy-Actor, spawn-actor, unreal-engine, loop, question\
**Created:** [December 25, 2020, 2:39pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actors-with-keypress-and-play-in-idle-indefinetly-out-animations/476384 "2020-12-25T14:39:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaneBlacic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DaneBlacic](https://forums.unrealengine.com/u/DaneBlacic)\
**Post date:** [December 25, 2020, 2:39pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actors-with-keypress-and-play-in-idle-indefinetly-out-animations/476384/1 "2020-12-25T14:39:59Z")

</div>

Hi everyone,

I need to spawn multiple actors, one after another, with IN + IDLE (played until key press event) + OUT animations (imported from fbx). The actors should be the boxes or other objects, but not the rigged characters.

So the logic should be like this:  
Key pressed event \> Spawn Actor1 \> Play IN\_Actor1 \> Continue to IDLE\_Actor1 \> Loop IDLE\_Actor1 indefinitely and wait for another Key press \> On Key pressed blend IDLE\_Actor1 animation to OUT\_Actor1 \> wait for OUT\_Actor1 to finish \> Destroy Actor1 \>\>\>\> Key pressed event \> Spawn Actor2 \> Play IN\_Actor2 \> Continue to IDLE\_Actor2 \> Loop IDLE\_Actor2 indefinitely and wait for another Key press \> On Key pressed blend IDLE\_Actor2 animation to OUT\_Actor2 \> wait for OUT\_Actor2 to finish \> Destroy Actor2 \> Key pressed event \>\>\>\>…

I would really appreciate if you could at least point me in the direction of how should I solve this. Is it with State machine? Is it with sequencer? Or just with the Level and Actor Blueprints?

Thank you so much for helping me out on this one.  
Dane

---

<div class="post-metadata">

**Author:** ![Fraps2020](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fraps2020/32/460865_2.png) [@Fraps2020](https://forums.unrealengine.com/u/Fraps2020)\
**Post date:** [December 25, 2020, 3:22pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actors-with-keypress-and-play-in-idle-indefinetly-out-animations/476384/2 "2020-12-25T15:22:36Z")

</div>

Hi DaneBlacic,

this is how I’d do it:

- I would manually build the blendings through an Animation Montage: [Animation Montage | Unreal Engine Documentation](https://docs.unrealengine.com/en-US/AnimatingObjects/SkeletalMeshAnimation/AnimMontage/index.html). A cool thing about Montages is that you can replay them starting from anywhere within their sequence (you can have “section”, or tell your Play Montage node to start replaying from a specific point in time)
- each Actor has its blueprint that tells him to play IN on spawn then continue to idle; in each Actor, have also a custom event to trigger OUT (lets call this custom event TRIGGEROUT)
- in the Level Blueprint, listen for your keypress event to Spawn the Actor. Store a reference to the Actor you’ve spawned again in the Level Blueprint, listen for your keypress event to trigger the TRIGGEROUT custom event in your Actor (that’s why you need to store a reference to it; so you can use it to trigger the event)

The above give you a solid starting point, or so I hope!

Cheers,

f

---

<div class="post-metadata">

**Author:** ![DaneBlacic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DaneBlacic](https://forums.unrealengine.com/u/DaneBlacic)\
**Post date:** [December 25, 2020, 3:32pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actors-with-keypress-and-play-in-idle-indefinetly-out-animations/476384/3 "2020-12-25T15:32:45Z")

</div>

Hey Fraps77,

Thanks for replying.  
The Montage is not available anymore. I’m using the 4.26 version.  
Nevertheless, I can do this in Sequencer and easily blend the animation tracks (just overlap them). The question here is - how to make sequencer to play the IDLE track indefinitely?

The rest helps a lot! Thanks once again 🙂

---

<div class="post-metadata">

**Author:** ![Fraps2020](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fraps2020/32/460865_2.png) [@Fraps2020](https://forums.unrealengine.com/u/Fraps2020)\
**Post date:** [December 25, 2020, 3:39pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actors-with-keypress-and-play-in-idle-indefinetly-out-animations/476384/4 "2020-12-25T15:39:17Z")

</div>

Hey Dani,

I’m referring to “Animation Montages”. Of course they’re still there – for some reason there’s a mistake in the link I posted (just fixed it). Correcting and trying again: [Animation Montage | Unreal Engine Documentation](https://docs.unrealengine.com/en-US/AnimatingObjects/SkeletalMeshAnimation/AnimMontage/index.html)

---

<div class="post-metadata">

**Author:** ![DaneBlacic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DaneBlacic](https://forums.unrealengine.com/u/DaneBlacic)\
**Post date:** [December 25, 2020, 3:45pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actors-with-keypress-and-play-in-idle-indefinetly-out-animations/476384/5 "2020-12-25T15:45:42Z")

</div>

Perfect, I’m on it… I will let you know how it goes.  
Thank you so much!

---

<div class="post-metadata">

**Author:** ![Fraps2020](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fraps2020/32/460865_2.png) [@Fraps2020](https://forums.unrealengine.com/u/Fraps2020)\
**Post date:** [December 25, 2020, 3:46pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actors-with-keypress-and-play-in-idle-indefinetly-out-animations/476384/6 "2020-12-25T15:46:29Z")

</div>

Oh, didn’t mention – you can mark any of your animation montage section as to let it loop indefinitely.  
The official documentation is pretty clear on this one!

Cheers  
f
