SpawnActor second line not working... plain confused


Short and sweet:

First line spawns actor, second one doesn’t.
The only thing I’ve really tried to change is the rotation.

Thanks for any help.

You should get some sort of message in your log on why it did not spawn. LogGameMode is the logname I think.

I tend to use the following for my spawn parameters:


 FActorSpawnParameters SpawnParameters;
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;



You spawn two bullets that visually overlap. What do you expect when calling the same spawn code directly after another?

@Rumbleball I was checking the actor amount, there was only one spawning.

@acxsasx thanks, where do I put that? in the projectile.cpp?

That would be your “spawnParameter”. There really should be a log message giving an explanation if it is not able to spawn it. Otherwise, your conclusion about it spawning may be wrong. Not sure what you mean by checking “actor amount”.

You stated you changed the rotation, but your example does not show it. So without more context we are just guessing.

My spawning problems so far have always been an issue of collisions preventing the spawn and I have always been given a message in LogGameMode.

@acxsasx When you press play in the editor, underneath the actor list there’s a number of actors in the level. When I spawn one in, it goes up by one. However, it doesn’t go up by 2 when I did this code.

Are you talking about the World Outliner? If it does not increase, then I would suspect something too.

Again, your log should have something in it. I use Notepad++ to open the log file and do advanced searches.

I was following a tutorial, apparently they were destroying each other because they were being spawned too close. (NOT because of the spawnparams, because I made them destroy themselves on collision with an object)