Hello, I’m making my first game in Unity, it’s a 2D runner.
I have created some levels and at the end of each level, there’s a box that unlocks the next level and loads it.
But, the problem is, the player can load the locked levels.
What I have done:
- Created a button for each level.
- Made a lock texture and added it on each level.
- When the player finishes say level 1 (hits the box I mentioned above), the next level will be unlocked and lock is no longer active.
But even if the lock is active, the player can still load the level and I need to prevent this from happening. Any help, please?
If you can provide explanation too, that’d be great. I’m still very new to Unity. Thanks.
Level manager script:
Levels Select scene:
Link for the tutorial I used for the script: Level Select Map - Unity 2D Platformer Tutorial - Part 29 - YouTube