Hello,
i would like to make a very simple undo mechanic on my game.
The mechanic is to save the last save on the array when the button "X" is triggered , then load the last save (from the front) of the array when the button "L" is triggered and then delete the last entry of the array (from the front)
Like this i imagined that the player can save several times and used these saves to "undo" (for the player, it will look like an undo) his last moves.
All works EXCEPT the delete of the last entry in the array, i don't know why but when i load the game the last entry stay...So the player can only load the last save and not all previous ones...
I assumed that it was cause the game was already loaded so the array is loaded too and have all the variables that it contained before the loading but i'm not sure and even if it's the cause, i don't have any solution since i have tried several times to figure out this point.
Below some screenshot of my code, it is simple but you can ask me some questions if needed.
Thank you by advance for help