# How to randomly play one of two animations?

**URL:** <https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182>\
**Category:** Mobile\
**Tags:** unreal-engine, question\
**Created:** [April 21, 2014, 4:19am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182 "2014-04-21T04:19:42Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![ClaverFlav](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ClaverFlav](https://forums.unrealengine.com/u/ClaverFlav)\
**Post date:** [April 21, 2014, 4:19am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/1 "2014-04-21T04:19:42Z")

</div>

i need a character to play one of two animations, but grabbing it randomly.

im totally lost how to do a if statement in an anim state machine, how do u do this?

---

<div class="post-metadata">

**Author:** ![Zeustiak](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zeustiak](https://forums.unrealengine.com/u/Zeustiak)\
**Post date:** [April 21, 2014, 8:04am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/2 "2014-04-21T08:04:58Z")

</div>

Use a RandomInt node, 0 to 1, and then an InRange node to check if it is 0. Tie the InRange to a branch, and if it is 0 it will execute true, and if not then false.

---

<div class="post-metadata">

**Author:** ![ClaverFlav](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ClaverFlav](https://forums.unrealengine.com/u/ClaverFlav)\
**Post date:** [April 22, 2014, 4:04am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/3 "2014-04-22T04:04:36Z")

</div>

… where is this “branch” you speak of?

 ![4574-randomanim.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/9/ea99748e992d1cd76f64cbc83d49485defe23c6b.jpeg)

i would really like a switch(case) that can do one of possibly six different anims… so yeah… im lost

---

<div class="post-metadata">

**Author:** ![Zeustiak](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zeustiak](https://forums.unrealengine.com/u/Zeustiak)\
**Post date:** [April 22, 2014, 8:45am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/4 "2014-04-22T08:45:25Z")

</div>

Hmm, are you in the material editor? Maybe it doesn’t have the same options? Can it call functions or macros? Maybe if you create a function in your class blueprint you can do the switching there.

Yeah, I think that would be the better place to do that anyway, unless you have some specific circumstances.

Branch is under Utilities - Flow Control.

Also, In Range (Float) is the range checker and should work fine.

---

<div class="post-metadata">

**Author:** ![ClaverFlav](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ClaverFlav](https://forums.unrealengine.com/u/ClaverFlav)\
**Post date:** [April 23, 2014, 6:04am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/5 "2014-04-23T06:04:39Z")

</div>

those flow controls are not there, and im in the animblueprint of a character class.

i found blend poses with a float alpha, there seems to be no way to do a switch case system for it.

---

<div class="post-metadata">

**Author:** ![RickRickerson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RickRickerson](https://forums.unrealengine.com/u/RickRickerson)\
**Post date:** [April 23, 2014, 9:32pm UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/6 "2014-04-23T21:32:21Z")

</div>

I think the ‘Blend Poses by Int’ node will do what you are looking for. After adding the node to your state, you can rt-click it and “Add Blend Pin” to add as many input animations as you need.

Good luck!

---

<div class="post-metadata">

**Author:** ![ClaverFlav](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ClaverFlav](https://forums.unrealengine.com/u/ClaverFlav)\
**Post date:** [April 24, 2014, 4:24am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/7 "2014-04-24T04:24:14Z")

</div>

OMG thank YOU!!!

k this is gonna rock. 🙂

---

<div class="post-metadata">

**Author:** ![ipas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ipas](https://forums.unrealengine.com/u/ipas)\
**Post date:** [February 24, 2015, 6:55pm UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/8 "2015-02-24T18:55:14Z")

</div>

The sequence variable of the play function can be promoted to (As Pin) Sequence. Create a Select to this pin. The select function got by default two options wich can be expanded ( right click ). Use an integer to select between the option. Now you only need to set this integer to a random value.

 ![30979-play-use-pin.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/7/7/e77e2c450aba479b21839afaa15c1755844cd90c.png)

---

<div class="post-metadata">

**Author:** ![JaroMast](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JaroMast](https://forums.unrealengine.com/u/JaroMast)\
**Post date:** [June 14, 2015, 9:27am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/9 "2015-06-14T09:27:12Z")

</div>

In this solution, I’m able to use this sequence in Transition Rule? I suppose it is not possible

---

<div class="post-metadata">

**Author:** ![monodrobe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@monodrobe](https://forums.unrealengine.com/u/monodrobe)\
**Post date:** [December 18, 2015, 4:28am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/10 "2015-12-18T04:28:49Z")

</div>

im having a similar problem, I feel like this could be the answer but i can t seem to make a play anim sequence that takes an input  
also not 100% sure what type of pin you made the options, as theres various anim sequence choices, base and without and then reference, object etc

---

<div class="post-metadata">

**Author:** ![aristides](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@aristides](https://forums.unrealengine.com/u/aristides)\
**Post date:** [September 17, 2016, 4:39pm UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/11 "2016-09-17T16:39:06Z")

</div>

Look up the node called Random Sequence Player. That’s exactly what you’re looking for.

---

<div class="post-metadata">

**Author:** ![Philippe23](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Philippe23](https://forums.unrealengine.com/u/Philippe23)\
**Post date:** [March 10, 2017, 2:28am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/12 "2017-03-10T02:28:20Z")

</div>

Thank you so much for this, way better than random integer stuff.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d4e137fe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d4e137fe](https://forums.unrealengine.com/u/anonymous_user_d4e137fe)\
**Post date:** [April 25, 2017, 11:52am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/13 "2017-04-25T11:52:43Z")

</div>

It’s a pretty simple solution but it worked for me

 ![135454-solution.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/2/4/1244b87124cdd740d0fa10e3ad60dfb510e3cccf.png)

---

<div class="post-metadata">

**Author:** ![JenAnty](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jenanty/32/965098_2.png) [@JenAnty](https://forums.unrealengine.com/u/JenAnty)\
**Post date:** [October 10, 2017, 3:08pm UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/14 "2017-10-10T15:08:42Z")

</div>

Thank you, cool node.

---

<div class="post-metadata">

**Author:** ![StBlueFire](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stbluefire/32/641418_2.png) [@StBlueFire](https://forums.unrealengine.com/u/StBlueFire)\
**Post date:** [January 12, 2023, 12:36am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/15 "2023-01-12T00:36:44Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/9/f9958e0421844a0620601733c85782f45301b153.png)

This is how you expose a sequence as a pin.

---

<div class="post-metadata">

**Author:** ![WrathOfAl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WrathOfAl](https://forums.unrealengine.com/u/WrathOfAl)\
**Post date:** [April 1, 2024, 2:54am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/17 "2024-04-01T02:54:22Z")

</div>

Actually, there is an easier way!

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/2/532d379e6adeea97f1d62f726c72663629f5588f.png)

---

<div class="post-metadata">

**Author:** ![DemonicArthas](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/demonicarthas/32/1123332_2.png) [@DemonicArthas](https://forums.unrealengine.com/u/DemonicArthas)\
**Post date:** [February 13, 2025, 7:22am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-one-of-two-animations/281182/18 "2025-02-13T07:22:23Z")

</div>

If anyone stumbles upon this in the future and want to do this inside the anim blueprint, just use the “Random Sequence Player” node
