The game instance is a good thing, I like it so much that I even wrote it to the save system, but found a question mention, it doesn’t disappear with the Delete Game in slot because it’s an advanced system, the game starts, it spawns, the game exits, it destroys, it’s just, if I delete the Game in slot, don’t quit the game, start the game from scratch, then the value in the game, is the value of the last deleted save, this is incorrect, how do I delete the game In slot, delete Gameinstace?
Create a public function to delete your SaveGame in your GameInstance, then you can call your “DeleteSaveGame” function from any other Blueprint. ( Use Get Game Instance then cast it to your GameInstance class )
Do you mean you’re saving a reference to your game instance? That won’t work…
HI, is that so? I tried it and didn’t seem to be successful, I passed the value of the game instance to savegame, and passed the value of savegame to the game instance when loading the game, it didn’t seem to work, but I thought of a stupid way to set the value of all gameinstances when deleting the game save, although it was a bit of a lot of work.
HI, I passed the value of the game instance to savegame, and passed the value of savegame to the game instance when loading the game, it didn’t seem to work, but I thought of a stupid way to set the value of all gameinstances when deleting the game save, although it is a bit of a lot of work.
I don’t quite understand what you’re doing?
You can only have one game instance.
HI, I saved the value of the gameinstance to the save in the game, but there is a problem here, when I delete the save game, do not exit the game, start the game again, the value in the game instance is not deleted, so I now have a stupid way to manually set the value of all gameinstance when deleting the game in slot.
?
There is only one game instance.
I have some notes…
-
Why bother using the game instance? If you have to keep moving all this stuff backwards and forwards, you might as well just use the save game.
-
Don’t use async saving and loading. It will not work correctly in this case.
-
Why not use an array instead of hundreds of variable names?
-
You can’t save references to objects. Not even the game instance.
HI, sorry, I’m a rookie, isn’t it convenient to save variables in gameinstace compared to other communications? Get all class actors are too performance-intensive,and I can do that
depends on your needings…
For Multiplayer, i would not suggest to store game related variables into the GI… just of cheating reasons.
I would split Variables across the rule specific actors (GameMode, GameState, PlayerController, Pawn…) and just take them into save when needed.
The GI should only be used when changing maps, to hold persistent variables, that get set back to default after loaded into a new level (again… cheating reasons…)… Or, to store Game Settings of the User.
Hello, manually setting the default value of GI is too much work, is there any node that can set GI as default value with one click?
GetClassDefaults is the Node you are looking for. It will return all default values of all public accessible Variables of the specific Class… your GameInstance f.e.
Thank you very much, saved me most of my time