Randomly Selective Actor Spawning

I’m trying to choose a random actor from among multiple actors and spawn a new actor at the chosen actor’s location, while at the same time destroying the chosen actor. Everything works as intended, except a new actor is not spawned. There are no errors and the blueprint says that it completes properly, but the new actor never shows up in the world. Am I missing something? Can anyone provide a solution?

I would suggest putting a break point at the Spawn Actor node, just to confirm that you are getting the transform from the actor you destroy. If the actor gets destroyed before you get the transform, it might give some random spawn transform. So a good way to avoid that possible scenario would be to store the actor transform in a temporary variable and then destroy the actor. Then connect this variable to the Spawn Actor input.

If it still doesn’t spawn, try putting a delay before the Spawn Actor node just to verify that there are no weird collision problems even if you’ve ticked it in the Spawn Actor. Finally if that doesn’t work either, try breaking up the transform, get it’s location vector and some small offset to it’s z value. This is just to make sure that the spawn transform won’t make it clipped to the ground.

Ok, well… I tried storing the vector as a variable, as you suggested. And now the room spawns in the correct location. But it is also smushed into a cube. Any ideas as to why this is? As hilarious of a discovery as this was, I need my rooms to be un-smushed, if at all possible.

Alright, cool. So now that the room is spawning, the reduced size is either due to the cone actor having a scale lesser than 1, or the test room actor itself having a scale less than 1.

Try adding a test room actor to the level in the editor to see if it’s of the correct size. If it is, then it’s most likely due to the transform value of the cone actor.

So in this scenario, before saving the transform, right click it’s return value and break it. Now create a new transform using the same location & rotation values, but with a scale of 1 and store this in your ‘Vector Chosen’ variable. Hopefully that should take care of the problem.

I thought exactly that, and attempted to solve the problem using that exact method. But it still isn’t working. All of the actors in question are at least 1 world scale in all dimensions. But it did occur to me that the thumbnail for the TestRoom actor shows it as being squished, as it is in the world. And if I drag it into the world, it remains squished until I drop it. But once it’s plopped into the world, it shows up properly. I’m absolutely out of ideas.

In your test room blueprint, does it have an additional scene component as the root? If so, check the scale for this as well.

Apart from that, maybe just check if you’re doing some scale transformations in your test room construction script.

In order to keep things clean, I normally add a Scene Component, name it “Root”, and add other components onto it. That way other components can be edited without adversely affecting anything. But that wasn’t the problem. Although, I still don’t know exactly what the problem was. I created a new blueprint and remade the entire room, exactly as it was before, and now it appears to be working properly. I’ve had 4 different room blueprints so far, and as far as I can tell, they’re all identical, aside from their name. The only thing I did differently for the last blueprint was create it from scratch instead of duplicating it. I’m at a loss, but I guess it doesn’t matter if it’s working now. Thank you for your contribution.