I want to read a JSON file and from the data in the file create actors when the engine is running. However going from C++ to blueprints is giving me issues and it’s turning into a mess. I feel I’m not using the right approach and I’m wondering how you guys would cleanly architect a scenario like this.
The mess is caused by me not knowing what to do in C++ and what to do in blueprints. So I’m doing stuff in C++ that I should be doing in blueprints and vice versa and there’s all kinds of needless communication between these layers. My main preference currently would be to do as much as possible in blueprints (although that is a version control / Git nightmare, but that is another discussion).
I’ve created C++ parent classes and created blueprints off of those in the editor. The blueprints are my main actors I want to work with. Why the C++ classes, because I have not figured out how to spawn a blueprint class created in the editor from C++. I would love to skip the C++ base classes but those are the one I create from the JSON data.
Another issue I’m running into when hot-reloading C++ code I cannot save my map / level blueprint anymore due to “Can’t save …: Graph is linked to object(s) in external map. External Object(s): /Engine/Transient”, not dissimilar from this: https://answers.unrealengine.com/questions/97059/graph-is-linked-to-external-enginetransient.html
I think this is because of creating objects in C++ and not destroying them (and storing them in a static variable)? I’ve tried supplying an Outer to NewObject but so far that hasn’t worked. (Anyway, I hope this will be fixed by using the right approach.)
To repeat my main question: how would you guys handle a situation where you have to dynamically create multiple actors in a running game from information in a file, so that most of the logic can be implemented using blueprints. If this is not actually viable and I should just defer to C++, please tell me that.
I can’t really share any code or blueprint screenshots due to work but I’m hoping for inspiration from your approaches.