I am going to ask this question again.And I am quite disappointed that I have got no answer till now.This is kind of stuff which will help me to decide to stay with UnrealEngine or not.
In my project I have a lot of settings which are defined by user via GUI before the game start.I need all those settings to be accessible both in BluePrints and in my C++ codebase.In typical architecture design there would be a singleton objects which allows to any objects anywhere in the API to access it.Now,I have really no idea how to set it up in Unreal.If I create in in C++ then to expose it for blueprints I need to extend it in the editor which means,if I get it right ,it will become a completely new objects which existence is not known to the C++ side of the game.So what is the “Unreal” way to handle such a scenario?
If you create the superclass in C++ and you set up every variable and function you want to reach with the correct macros, then you can reach them from both C++ and Blueprints.
Variables need to be set up as properties: Unreal Engine UProperties | Unreal Engine Documentation ) with for eg. a BlueprintReadWrite specifier then by using its blueprint subclass you can read and write the specified property from both c++ and blueprint.
You have to make UObject the parent of the C++ class to be able to subclass it in a blueprint, but it will be garbagecollected if you dont keep a reference to it, so you should check out this post on how to keep a reference to it.
I suppose it depends on whether it’s just a few boolean variables in which case it’s fine, but if you really need a lot of variables and data to be stored, it’s probably a good idea to encapsulate it in a different class