When I complete a level, the next one gets unlocked. But then it locks the previously done level.
Is my savegame blueprint not right? How do I make it remember that the previous levels are unlocked.
Hey there, you should just store 1 integer variable which holds the highest level you’ve unlocked, then you just need to compare if it’s less or equal than that, if it is, unlock it, else it’s locked.
Right now you are saving a bunch of booleans, you have to get rid of those and just store an integer variable (let’s call it Unlocked Levels). On the comparisons you are doing on button click you just have to check if the variable Unlocked Levels is less or equal than the level number you are testing. When you unlock a new level you save Unlocked Levels with the level number.
What is the problem you are having?
I appreciate your help a lot.
It is not adding +1 to the integer.
Does it execute the print?
Unfortunately not.
Ok so put the print of the Level Reached before the branch to see what is its default value.
Where are you executing that code?
On the level blueprint (from the previous comment) you are always create a new save, so that will probably reset it. You have to check if the save exists with Load save game, if it does you have to get the levels reached and see if its smaller than the current level you are in, only then do you want to override the existing value.