Download

For Loop with Spawn Actor Class Madness

Please help me what is happening:


Works exactly as I expect – on an overlap event 2 random locations in the Sphere Spawn Area are printed.

Then I change only the Print String node to SpawnActor Node


This spawns a random number of actors (something like 30+) to fill the area. Why is the SpawnActor node causing the loop to go way above the limit set by the Last Index?

Where are you calling this BP nodes? On a Custom Event?

EventBeginPlay off the level blueprint – just testing this one thing on the thirdperson map.

My bad – its happening on the EventBeginActorOverlap on a Collision Sphere, that only activates when the player overlaps. Its just weird that when its printing the coordinates, its fine. Its when I actually spawn the actors that it seems to just go haywire.

Put a print string after the Begin Overlap, before the loop and see how many times it fires.

Well it’s not weird.
IF you are detecting sphere overlaps, and every time there is an overlap you run the code… what do you expect would happen when you spawn an actor into the sphere thus creating an overlap?

That might be the issue. EventBeginActorOverlap might be triggering more than once. Try putting a DoOnce node and see if that resolves the issue