I have implemented Save & Load High Score just like this turotial:
But I’m trying to print the High Score while playing the game. I created function everything is fine. But High Score prints when my character died, after death operations.
Is it some kind of lock mechanism on “Save File” (you can’t read while some other function is accessing same file) or I’m doing something wrong?
You have to save changes to your savefile. Different to variables it will only change once it’s saved. The performance is good enough though to easily do this in real time without serious penalties.
So just save your savegame object everytime you change the variable and it should work.
Whenever you work with savegames you should always load it when you want to read a value (like directly before you read it) and save it right after every change you do. That way it always worked for me.
If you just use “Load Savegame” whenever you check the variable you should always have current and accurate value. Try to work less with the reference to a savegame object. If you meant something else I did not understand it.
You are using a savegame right?
They maybe try to not use the reference from your “RunCharacter” but instead load it new with the “Load Game from Slot”.