I’ve been deconstructing a template to see how all the blueprints work and I’m currently trying to teach myself how to use the game instance to save variables from one level to another. The template I’m using has a bunch of variables in its BP_SaveGame and I’d love to store some of these variables on my game instance to carry over to other levels.
Much of what I want to save are Arrays like the Inventory array. I’m a little confused on how to save and recall these arrays using the game instance.
Do I need to copy all these array variables I want to save between levels to my game instance? How do I cast the array variables to the game instance?
Am I able to create a save prior to moving to a new level and extract specific variable info from the save file?
If you’ve already implemented this in the save game, then there’s no need to do anything with the GI.
The save game is basically like a super version of the GI. The GI survives between levels, but won’t make it through a restart. But the save game will.
If you really want to also use the GI, for some reason, then just read the save game into a variable in the GI. That’s it.
Store infos into GameInstance, sent into SaveGame, and that pretty much all you need to do, as far as i learn GameInstance are well for Networking. ClockWorkOcean answer well too.
I guess what’s confusing me is that there are variables going into my save game, i.e. Character location (Which I assume is what PlayerTransform_Save is) that I wouldn’t need to call as I enter a new level, only if I am wanting to go back to a previous save point. So not sure if I could just load certain variables from my save?
I have a journal and inventory that I want to save in one level and then load in a new level. However, how do I send an inventory array to the gameinstance? Do I drag the inventory array variable into a blueprint and cast to gameinstace?
I you want to save something in one level and get it back again in another, the save game is the way to do that. Yes, you can do that also with the game instance, but that is not resilient to restarts.
If you want to access you save game in the GI, just
First do I want to put these nodes on my Character?
Should I use something other than an EventBeginPlay?
I have a save game file that contains all the variables you see on the left in this screenshot. I am trying to load certain ones when my player enters new levels, but it’s not loading anything.
Somehow game instance doesn’t carry arrays into the next level.
First:
That seems unlikely, there’s no difference between “array of thing” and “thing” in the code
You should probably use a new thread for a new problem – the question in the original thread was something different, and just incidentally used arrays