How to Lock Levels.

I have a level based helix jump game. I have created 10 scene in unity which denotes my 10 level but i want to lock the levels expect level1. And when lvl 1 is completed lvl2 should unlock. How do I do that.
I have also posted a level selection scene image below. Help me.

You can watch my gameplay to get better understanding.

Gameplay Link =

Use PlayerPrefs to record the highest level they have unlocked. Disable the buttons for levels higher than they have unlocked.

1 Like

Can u please explain breifly and send code

That’s too specific a request for anyone to have premade code handy for. But below is the scripting reference for PlayerPrefs, and an example of setting a button’s interactable property to false.

https://docs.unity3d.com/ScriptReference/PlayerPrefs.html
https://docs.unity3d.com/2019.1/Documentation/ScriptReference/UI.Selectable-interactable.html

You basically save the highest level you have completed and save it (int) to playerprefs. At the very beginning of level select. Check if playerpref contains save highest level reached. If player not level 5 then lock the level 6 or make the button not clickable or whatever.

I dont have a pre code made. I dont use playerprefs. I use something more advance and harder to understand. Here is a video that will help you: