What ever I do I creates a new save game.
I fixed it by getting all the variables in the widget blueprint but the question remains why it was not working within the main character.
It’s a really tiny pic. Are the slot names the same?
It’s been a while i’ve done that, but from here, with my optics zoom x4000, why do you save again after the load ? You should just set the variables from the casting after the load game slot reference. Try without the save game to slot at the upper part. Bottom part is correct.
Yes.
It just checks the variable if the score is higher then the saved score then it will save the saved score again
Ah, is the first version on tick, by any chance? ( the one in the widget is by defaut, basically ).
No, it is from an overlap event of a box collision.
Looks like you are spawning a new “main character” every time. It’s not the same actor, it’s variables are reset; so the “score” Int variable (first screen) is 0( loading a new map = new actors). It seems your widget is always the same the whole game so here it works, depending on how you spawn/create your widget you will have the same problem when you change map, if a new widget is created.
This kind of stat “score” should be keep in something who stay the same the whole game like gamemode.
Do a print string on your character name when it appear, is it always “maincharacter” after a load ? Or did it became “maincharacter1” or something like that? Then you found your problem. Do a print string on the Score variable from your character on the first screenshot. It should be 0 after the load right?
Edit: the 2 screens are not the same. ++ mean you add 1.
This is how I usually go about setting up a Save System in my games:
(In the Game Instance blueprint for easy access)
I would suggest keeping the Save and Load functions separate from manipulating variables. You can use the Save Game Object Ref to get and set variables.
You can Load variables from the save game like this:
and Save variable like this: