How to spawn random meshes in array

In this pic how where ‘spawnActor BP Collectable’ is, how do I use an array so it will spawn 1 random mesh (out of 5).

I think a setup like this is what you are looking for:

  1. The array in question is an array of Static Mesh Actors. DON’T use static meshes; they cannot be used in conjunction with the spawn actor class. No worries though, you can use any static mesh as a static mesh actor class anyway. Alternatively, you can also just use an array of static mesh actor classes, allowing you to skip the step of later of getting the class of the static mesh actors.
  2. Last index returns the index of the last object in the array, so we use that and 0 as the range for the random mesh. I know you said you have five meshes (so technically, you could also fill in 4 as the max range), but I think this way is a bit safer. Plus, you won’t have to constantly change the max value in case you wish to add a 6th mesh or more.
  3. The “GetClass” function is necessary to get the class of the static mesh actor you put into the array. Of course, you could just make the array a class array, and skip this part entirely.

That’s great thanks for helping your comment and picture made it clear and easy to understand.