Facing Problem while saving the lock/unlock levels

I am making multi-level platformer game. Now I have add two scenes scene1 and scene2 ( scene3 is not added in the code, so leave that aside).
First the player have complete the scene1. Then only scene2 will unlock.
*locked/unlocked scene code is perfectly working.

Main Scene Working:-
In “Main” Scene, we have two objects name scene1 and scene2.
Scene1 and scene2 have two object variables locked and completed. For scene1, locked=0 ; completed=0. For scene2, locked=1; completed=0.
When player completes scene1, values of objects variables of scene1 updates: locked=0, completed=1.
Now global variable scene1completed=0(initials) updates to scene1completed=1.
This value of global variable I want to save (means games autosave when this occur). And when game starts first it check previously saved value of scene1completed.

Noted:- the game is for Android playstore.

global variable scene1completed is for scene1 completion.
global variable scene2completed is for scene2 completion.
… And so on multilevel scenes.

here is a tutorial about saving a HighScore but is the same you want for your game

Thanks it really helped me. Now I can save my unlocked levels.

bhai… i have same issue can u help me

nikhil bhai isme please meri help kardo yaar…pareshaan ho gaya hun…please

bhai mere unlock stages save nahi ho rahe hai…aur maine ise global variable score k saath kiya hai…i spending 12 hours on it…but samajh me hi nahi aa rha…kuch help kardo bhai job ka sawal hai

You can’t load saved values to a global variable. Try making a scene variable to load the storage and then set the global variable to that variable

1 Like