Save structure in blueprint?
Hello, I've created a blueprint struct with various game data variables. Below shows a number of facial setups for characters.
I then made a scene with on screen buttons and sliders so we can visually edit those game variables while seeing the characters faces.
My problem: I can't figure out how to save the modded variables back to the structure? I don't want to use save games, because it's just internal data used for the game. So how can I make the modded data actually get saved back to the blueprint structure above (so if you were to look at that structure, you'd see the changed data)?
Long story short, you can't, using only blueprints, with the supplied nodes from Epic. There are many reasons for this, but the main one is, there is no way to "write" back to disk.
A structure should be thought of, well, as exactly what it is, a structure, just a set of data that one can group together with a name (i.e. the name of the structure), it's nothing more nor less, and as it appears to be "typed" differently than the rest of the system (i.e. try casting that structure to something else, so it appears to be a "object type" that has no parent). As there is no inherent abilities to write to disk (assuming "disk" analytics would work, then a way could be cobbled together, but so far, I've only got error messages from that, as the Editor cannot find some DLL's at startup), then the structure, is just a variable with no parent, and cannot be used to write to disk.
If you roll your own C++ code, then you could create a "node" for blueprints in order to have this functionality. Also you may wish to check Rama's free library here in the Wiki to see if it has that.
Hope this helps,
answered Oct 02 '15 at 06:48 PM
You can do that just fine and pretty easily. All you have to do is get the struct and set members in it and done.
To select which members of the struct you want to change, just click on the "set members..." node and on the left side in it's detail pannel you will be able to select the pins of the variables you want to expose as input. Then you just plug your new variable in it and it will save it to the struct without losing any other variables that are already in the struct.
What this node basically does is internally transfer all the data from the struct to a new version of it except for the variables you changed, those are then integrated into the "newly" formed struct and thus using this node you are able to push updates to a struct very easily.
In our project we use this fo all our customisation and saving, including game options. Everything is updated on the go, exactly the way you want.
Follow this question
Once you sign in you will be able to subscribe for any updates here