If all you are looking for is data management, then a Blueprint Struct might be something you are looking for.
You would create it with all the data you’d want, then add it as a variable to the level blueprint and extract/set data as needed.
This isn’t a very scalable solution if you are going to have many variables due to the visual limitations of Blueprints.
The C++ portion of this is fairly simple if you want to tackle it. You’ll have to create a class that extends LevelScriptActor and set up your variables in there, then your Level Blueprints can parent it. This method is way more flexible and easier to manage than the Blueprint Struct. It is also more stable, as I’ve frequently ran into issues with very large structs.
I’m currently looking for the best way to set up the following: when a level is loaded, a variety of actor parameters inside the level is set up based on an array of global flags stored in the game instance. The logic for getting the flags is shared for all the levels but what is to be done when these flags are set has to be customizable in each level and be as flexible as possible (e.g. some flags might toggle or replace NPC dialogue, some might switch the NPC behavior, some might replace the NPC with a “dead” model, the list goes on, and one flag can be used in multiple levels to add on top of it).
After exploring my options, it seems that the level blueprint is the best place to have this functionality: out of the box, it is loaded automatically when the level is loaded, it can access all the actors in the level without going through the hassle of setting them up, and it gives me the extent of flexibility I want in the system.
However, I ran into a problem trying to set up the shared part of the logic - getting the flags and so on. This would normally be easily solving by making a parent object and then extending for individual levels, but alas I can’t seem to find a way to do this with level BP without doing it in C++ (I’ve seen the excellent Rama’s guide but I have little experience with C++ and reluctant to take the dive without proper preparation). Now, I can of course just copy-paste this stuff from an empty level each time I make a new one, but it has an obvious fatal flaw of having to redo everything in case I decide to change something in the shared logic.
So, is there a way to reparent the level blueprint to have the extended functionality I want without involving C++ I am missing? Or is there a better way of approaching this problem in BPs? Or should I brace for impact and go down the C++ rabbit hole?
The problem is there’s no fixed number of specific variables. One level might take flags A and C, the other B and D and E, and the third one C only. And for the specified flags it needs to get their values from the array stored in game instance/save game which basically contains all the global flags. It is this functionality that I want to be shared. Then each level blueprint would go on its way to do whatever the level designer wanted with each of these flags.
I may be misunderstanding but I believe the struct won’t be of much help in this case.