Game Instance and Game Save and Game StateVR Game

Hey everyone, I am creating a VR game that resembles an arcade-style of scoring. Right now my points transfer from level to level using the Game Instance but what I would really like to do is have the points carry over after a completed game, so when you come back you have as many points as you had when you left and you can continue. I’d like to do this with little to almost zero menu interactions. Points are the only things I care to have carried over so I was wondering what could be the best way to execute this. I keep getting mixed signals from the internet on which one to use. Any help would be great before I start blueprinting too much and waste a lot of time. Thank you for any advice!

Save game object is the answer.

It’s works just like the game instance, but persists between game runs.

@ClockworkOcean Thank you!

So as of right now, all my points are going to a game instance, are you saying I should change that to a Save Game Object? Or use both? Does Save Game Object survive between levels? Very appreciative of your reply.

Game instance exists the whole time while the game is running, so it’s a great way to preserve things between levels. But when the game stops it’s gone.

Save game looks very much like the GI, but persists between runs of the game:

@ClockworkOcean Great thank you for the link. After watching, I’m still a little confused I guess. Does GSO persist level to level the same way GI does? Or could I cast my GI points to a GSO once a game is completed? Or is that unnecessary?

Game instance only exists while the game is running and is always available.

Save game stays on the hard drive after the player exits the game, so is available next time they start.

If you want things to persist between different sessions, you have to put it in the save game :slight_smile:

You’re the best thank you!

@ClockworkOcean

Hey I hate to bother but I am running into a lot of difficulties here and it’s making me a little more angry than I should be lol

I basically don’t know where to start. The points that are being collected are currently being casted to my game instance where I created my references. You collect the points by mowing over grass.

I am now trying to make it a Save Game and can’t figure this out. I’m providing my blueprints. Any help would tremendous. This is also very embarrassing considering I really have no idea how to turn it into Game Save lol I made it game instance no prob this is very complicated me atm

I will look at this properly tomorrow, but a quick look now tells me the same thing I usually see with save games.

Here’s how they work

  1. Create the save game ONCE. On begin play for example.

  2. When you want to read: load game from slot, cast and read

  3. When you want to write: load game from slot, cast, write, save game to slot

The two most common mistakes are, creating the save game every time it’s used ( which mean’s it’s always going to be empty ), and not reading the save game before updating and saving it ( which also means it will not work properly ).

You’re a lifesaver! I’ll dig a little deeper. and excited for your next response!

This is how you use a save game:

Tha’s a lot more clear.
With that being said, I’m using multiple variables (points) on my widget, would I then be saving the number of points that appears on the widget?
I created all my variables in my game instance, would I then delete those and recreate them in the GSO?

THANK YOU. Seriously, you’re a lifesaver.

You have to write code to save everything relevant that you put in your save game ( ie stuff you want to save ).

You don’t have to save it all of once of course, bits here and there.

It’s easiest to do it in a macro, so you don’t have to keep fiddling around with those nodes above.

Really depends how you want to do it, but I made a different macro for every part of my save game. So, for a given asset / blueprint I can just use one node to get and save all the settings.


You can use the save game to pass info around, just like the game instance. Difference is with the save game, you then don’t have to come back and save the information later :slight_smile:

Game instance is more about enabling communication.

Yeah idk this just isn’t computing in my brain I guess.

What I’m hung up on is how do I tell it to save the points being counted in a function on my HUD that are being called from a game instance. I’m probably going in circles at this point.

Just use the the save chunk of code I gave you there… when you change it, save it.

What I’m getting hung up on is that I don’t know where to put it.

My points are being displayed and counted on my HUD from game instance, do I do it in my HUD? Do I save it in the BP of the item that’s getting me points? Or do I do it in my game mode? I hate to bug you lol. Just new to some of this is all

Show me you point update code.

First two are the points being collected after overlapping them (more points will be added to the game eventually)

The third photo is the function in the Widget adding them together to string them into a value.

Fourth photo is just the HUDBP

](filedata/fetch?id=1813021&d=1600455089)

You see, but it’s getting messy.

It would be easier in this case to drop using the GI for these point and just use the save game. It’s up to you.

■■■■ that’s what I was thinking as well. I’m assuming I would just delete them in the instance and re-do it in the game save. If that’s the case, do I need to re-wire my HUD bp to game save as well rather than instance?