# How to randomize widgets opening?

**URL:** <https://forums.unrealengine.com/t/how-to-randomize-widgets-opening/381193>\
**Category:** UI\
**Tags:** randomize-array, unreal-engine, Widget, Blueprint, question\
**Created:** [January 7, 2017, 4:12pm UTC](https://forums.unrealengine.com/t/how-to-randomize-widgets-opening/381193 "2017-01-07T16:12:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_d8f00615](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d8f00615](https://forums.unrealengine.com/u/anonymous_user_d8f00615)\
**Post date:** [January 7, 2017, 4:12pm UTC](https://forums.unrealengine.com/t/how-to-randomize-widgets-opening/381193/1 "2017-01-07T16:12:00Z")

</div>

Hey so I’m trying to set up a function where what it does is it chooses a random widget from all the widgets I created and displays it on the screen. I already have the widgets created I just don’t know how to do the randomizing part. Any help would be appreciated! If you need any images on something then I’ll be happy to send them!

---

<div class="post-metadata">

**Author:** ![Smomo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Smomo](https://forums.unrealengine.com/u/Smomo)\
**Post date:** [January 7, 2017, 8:28pm UTC](https://forums.unrealengine.com/t/how-to-randomize-widgets-opening/381193/2 "2017-01-07T20:28:45Z")

</div>

Here is a simple way.

Make an “User Widget Class” array and add the widget class you want to display

Notice: The type is “Class” not “Reference”

Then use Random Integer (or Stream) node to randomly choose the widget

 ![121186-randomwidgetclass.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/b/58bb273e0494d4132cbe93ac003c2cdc3cb536ca.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d8f00615](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d8f00615](https://forums.unrealengine.com/u/anonymous_user_d8f00615)\
**Post date:** [January 8, 2017, 12:28am UTC](https://forums.unrealengine.com/t/how-to-randomize-widgets-opening/381193/3 "2017-01-08T00:28:16Z")

</div>

I’m having trouble making the array… Can you explain that part a bit more? Also I want to make it so that it calls this when the player overlaps a box. So maybe turn this into a function?

---

<div class="post-metadata">

**Author:** ![Smomo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Smomo](https://forums.unrealengine.com/u/Smomo)\
**Post date:** [January 8, 2017, 6:08pm UTC](https://forums.unrealengine.com/t/how-to-randomize-widgets-opening/381193/4 "2017-01-08T18:08:42Z")

</div>

Sorry for late reply.

First, create an array

 ![121300-variabletype.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/b/fbb22d91a5576bfc207e7fb878535740b08f687b.png)

Add the widgets class which you want to display to array

 ![121311-addarrayelements.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/0/c/c0c6b4b9c2a9d844802370f0cf210b66535eb597.png)

Then make a Overlap event

 ![121312-setuponoverlapevent.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/f/ebf10d6de98e437a418da473ceff0b06f689de72.png)

---

<div class="post-metadata">

**Author:** ![Devolius](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Devolius](https://forums.unrealengine.com/u/Devolius)\
**Post date:** [July 6, 2022, 9:20pm UTC](https://forums.unrealengine.com/t/how-to-randomize-widgets-opening/381193/5 "2022-07-06T21:20:54Z")

</div>

Sorry to necro this post but I’m trying to do this but with an extra step and it’s not working the way I want it to. I have it set up like above but I’m trying to remove the widget that got chosen before applying another random one. Think when you level up in a game and get to choose 3 random abilities, that is what I’m trying to achieve.
