Question on the Random Spawn Actor

Hi Guys, i have a question on the spawn actor from class, there is a way to select the class in a random way from a list or an array that i have in my project ? I have this ten BP classes and on the event begin play i want a spawn of one of them, randomically, is this possible with the spawn actor from class ? Thanks.

Ps: At the moment i use a temporary solution with the random integer node, but it not work very well, thanks.

You can feed the random integer into a select node where each row in the select node is one of your classes, and then the output goes into your spawn node class pin.

If you have much more than 10 classes then I would make an array variable to put the classes in and put the random int into the Get node for the array.

yea what he said. though theres a typo in mightyenigma’s answer “isnone” should be “is one”.

below is an example of how you would accomplish this with an array and to get a random class from the array. by using the random int in range node and the last index node you can make the array as large or small as you like and the script will always get a valid index. so if you have two spawners in the world and one can spawn 3 type and the other 10 types you can use the same script.

Thanks to both of you !