Unlock level forget prior unlock

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.

Thank you for your fast reply.

How would I go about doing that? The first picture is my level select widget, the second is my level blueprint.

I seem to be stuck unfortunately.

Thank you for your help.

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.

Can you tell me what’s wrong here? Shouldn’t this add +1 if the level is equal or less than the level reached?

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.

Level 1 print “1”
Level 2 now print “0”

Where are you executing that code?

In the “Select level” blueprint.

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.