Can Actors spawn Actors? (crash)
I'm trying to spawn an actor in my c++ code, but it seems to automatically get deleted. Furthermore, if I run the spawning event twice, the whole editor crashes. The code I use for spawning is the following:
Which seems to be what one should do after reading other questions and resources on the web. FloatingActor's constructor:
The one thing I see that is different from some tutorials is that they tell you to spawn actors from the GameMode. Is that the problem? Why, and if not, how do I get the actor to spawn correctly? As said, it shows up in the world outliner as "deleted actor" but the debug messages from the constructor do get printed.
Edit 2: I've discovered it does not crash, and indeed seems to work fine if I omit the spawn parameters when calling spawnActor, i.e.:
Edit: Here's the callstack that shows up after the crash. As said, it only crashes if I spawn the actor twice.
I believe the reason it didn't work when you had the SpawnParams set was due to the setting you used for the SpawnCollisionHandlingOverride to ESpawnActorCollisionHandlingMethod::AlwaysSpawn. The default may be that it will not spawn on top of it but offset itself from any existing collision.
You're correct, the best way to do that would be to make it into a UPROPERTY so that you can set it from inside of the editor.
answered Feb 02 '16 at 03:59 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here