Download

Spawning Actors when I shouldn't be?

Hello,

I’m making a game where the player pawn steps on a tile and causes another tile to spawn. I believe I set it up correctly so that tiles shouldn’t spawn if they’re colliding with anything:



// Make it so no tile spawns if it collides with anything (like a wall!)
FActorSpawnParameters SpawnInfo;
SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::DontSpawnIfColliding;
        
// Spawn a tile and set it to be SpawnedTile
SpawnedTile = GetWorld()->SpawnActor<AActor>(TileClass, SpawnLocation, Rotation, SpawnInfo);
UE_LOG(LogTemp, Warning, TEXT("Spawned Tile: %s"), *SpawnedTile->GetName());


But when I test it, the SpawnedTile will still occasionally spawn overtop of another Spawned Tile. You can see in the image below, I have two tiles that spawned on top of each other. The red arrows point to when they spawned in the Output Log.

The BP_TileBase also has it’s Spawn Collision Handling Method set to Do Not Spawn as well.

Finally, here’s my Collision setting on the mesh:

Any ideas?