Spawn Actors from Plugin Threads
I am trying to spawn a static mesh actor into the editor from a C++ plugin that I am creating. The call worked great when I was prototyping in a slate UI control callback, but it is crashing now that I moved the logic to a thread in the plugin. Unreal is crashing when I make the following call from a thread in plugin.
AStaticMeshActor *actor = Cast(GEditor->GetEditorWorldContext().World()->SpawnActor(AStaticMeshActor::StaticClass()));
After debugging this in VS, it broke on the following line. check(IsInGameThread());
I am definitely NOT in the game thread. I have read the Multi Threading How To in the Unreal wiki. It definitely warns you not to manipulate UObjects from other threads.
So my question is: how do you accomplish spawning/destroying actors from other threads? There must be a way to do this. This information would be extremely useful to add to the Multi Threading How To wiki.
Thanks for the help! Dan
Don't want to break the bubble, but UE4 gameplay is essentially single threaded. Anything that touches UObjects must happen in the game thread.
What exactly is your plugin doing that makes you think that it will benefit from multithreading?
answered Mar 20 '16 at 02:44 PM
Invert interaction make UObject interact with your socket data that you received left in memoery by other thread, maybe on Tick()? OR some other event that needs that data
answered Mar 20 '16 at 07:27 PM
Thanks for all of the responses. I'll try these suggestions and post my solution for the next guy.
answered Mar 21 '16 at 05:08 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here