Download

How screwed am I? (Saving your game)

Heya good folks from the UE4 forums! I think I’ve made a big mistake. Currently working on a quick side RPG project as somewhat of a newbie to the engine. I decided to store all my variables from the project such as Currency, Health, Time of day, Strength, and even some random booleans into the ThirdPersonCharacter blueprint.

Now that I’m looking into how to save these variables and load them it looks like they don’t belong there. What should I do about it? Or is there a way I can set these variables inside a save state?

You should be fine with storing player-specific variables in the player character (or controller), but things that are not player specific (Time of day, etc.) should probably be stored in the Game State. If it is a single player game, you don’t need to worry so much about where things are located, since as the authority, the single player has access to all game framework classes (Be careful, you’d have a lot of busy-work if you wanted to let additional players play).

As far as actually saving the variables, it doesn’t make a difference where they are located, so long as you have access to them.

Here are some good reads:

https://docs.unrealengine.com/en-US/Gameplay/SaveGame/Blueprints

Thanks for your help this gives me some relief. Now I’m still having problems figuring out how to save the actual variables.

Saving your game is pretty easy. https://docs.unrealengine.com/en-us/Gameplay/SaveGame/Blueprints

I’ve been doing all my saving/loading in my GameMode, which I’m pretty sure is correct.