I’m working on procedural level building. Everything works fine, when I put my object generation into the GameMode class and spawn the actors there. But this will only work, when I start the game.
What I actually need is a place in code, where I can add actors to the editor in edit (design) time.
There seems to be no entry point, no class, where I can put my creation code.
To be clear, I want to do these steps, but in C++:
- create empty level
- add actors by dragging from content browser into editor
What is the C++ equivalent to do this?
Still waiting for an answer,
please tell me the class to derive from, when I want to do things BEFORE play starts. GameMode doesn’t help here. Thank you for your time.
Level Blueprint for the default map you are using, there is a construction script which can be used to do certain things interactively in the editor. You can expose your procedural functions to the construction script. You may want to watch the UE4 twitch video regard procedural dungeon room development.
“UE4 twitch video regard procedural dungeon room development”. Interesting, do you have a link?
Yep, that is the one, it is a good video to see proceduralism in UE4 and how to work with constructions scripts.
Thanks, I don’t understand how the construction script can place an actor at edit time. I need still to call world->SpawnActor which to me is only working after game has started, but NOT at edit time.
I have watched the video and I think it’s not spawn actor in construct script.It’s just make instance meshes in construction script.and you can’t spawn actor in construction script.
Thanks, so let’s forget about the construction script.
How can I place an actor in the loaded level only using C++?
The template code is centered around the GameMode class which is useless at edit time.
A proper engine implementation would give me a callback like
OnLevelLoaded() where I can put my additional stuff.