Where is the best place for Save Game/Load game functions?


I have 4-5 functions for saving games/loading games, but I wasn’t sure where to place them. To place them inside SaveGame class(inside .cpp) or inside GameInstance class? I’ve placed them inside GameInstance and for the life of me I can’t figure out the correct place for them.

What is bugging me the most is that I use those functions inside widgets. I didn’t want to bother with making widgets with C++, so those are Blueprints, and I didn’t want to create SaveGame object every time I use them (they are used across multiple widgets, not just one, so they would be created multiple times). I could create SaveGame reference inside GameInstance and use it like:


I do understand that GameInstance is mainly used to transfer data between different GameModes. Even thinking logically, functions, that are used for saving/loading, should be inside SaveGame object. Still wanted to ask where’s the best place for those functions?

Very new to UE4, and programming, thanks for the help,