The generated C++ code seems to build around the idea that everything starts with clicking “Play”.
Has anybody found a way to place actors at edit time?
This drives me crazy!:mad:
Thanks for helping.
Where should I place this call to UEditorEngine::AddActor?
Best would be a notification/callback, when the map/level has been loaded, so that I can add procedural content to the world.
I got you covered! I’ve been working on editor extensions and plugins for importing stuff into the editor world.
Check out FWorldDelegates::OnPostWorldInitialization. You can then get the WorldType variable from the UWorld* you’ll get through the callback.
To make it work only in PIE, just surround whatever you’re doing with an
if (InWorld->WorldType == EWorldType::PIE) kind of call.
If you want it to work in standalone/packaged, you need to check firstly that the WorldType == EWorldType::Game, but also that the GameInstance isn’t nullptr. This stops you from accidently reacting to the default initialized world (where the level isn’t even valid yet - you don’t want that!)
I’m sure you can figure out interesting ways to use it
, sounds interesting, let me look into this. Thanks.