Lock Unlock Levels - Help Please

Hello,

I’m a begginer on c#, and i’m making a soccer game.
For selecting teams i’ve putted the different teams on different scenes and load using loadscene script.
For better understand see the examples pictures attached to this post.

I have made a lock/unlock level but it looks/unlock only in 1 scene

There is any way of for example i open scene1 (Select team) and if i win against cabo verde, it unlocks in scene1 the button to go to scene 2, and after in scene2 i choose argentina and if i win it unlocks on scene2 the button to go to scene3 and so on ?

I’ve tested, it unlocks the button in scene1, but when i win in scene 2 it come back to sceen1 and dont unlock button in scene2

How can i do this in different scenes ?

Thank you


Sorry, I don’t completely understand your explanation. But it sounds like you want to unlock levels in a level select scene.

You’ll just need a way to determine when the button should be unlocked. Basically, when in your game scene, if the player wins, you would update a value somewhere that says what level is unlocked and then unlock up to that level. If you want it to display that level when they come back to the level select menu, then you’ll need something in an Awake or start that says what level to display.

Hey, i want to unlock levels in different level select scenes.

When the button is unlocked and the level that, is unlocked, i already can do but only in 1 level select scene, i dont know is the script that i will have to add to be able to use multi select levels scenes

I’m sorry, I’m still not understanding. You keep saying scenes, so do you mean you have several scenes where you can select levels? And by scenes, I mean unity scenes. I’m a bit confused as to why you might have multiple level select scenes.

Your screenshots show a flag on the first one and I see the green menu button. I’m assuming the arrow button on the right changes the flag to the next flag which is in screenshot 2. I see the menu button is not green in this one. I’m going to assume that what you are trying to do is on screenshot 1, you play a game and win. When you win, you come back to the menu and then can select the next flag, where the menu button should be green because you beat the previous level.

If this is the case, you’ll need to save out a value somewhere, like playerprefs that says what the last level you cleared was. Then when scrolling through your levels(flags) you use that number to determine if the button should be green and the level should be playable.

This is only a guess based on your screenshots of what you are trying to do.

Thank you for your interest
Yes when i say scenes, i say unity scenes
The reason that i have one unity scene per team (i have 9 scenes! You can see some scenes in attached photo) its because i’m a newbie and i dont know how to do a script that change the flags/textures/jersey :frowning:

The Green button is because the button is selected when i get a screenshot of gameplay sorry my mistake !!

And my point is, win 1rst team (Cabo verde) and unlock the right button to go 2nd scene.
After i win 2 level, unlock button in 2nd scene

Honestly, if you are using the buttons to change scenes, you should fix that first. There isn’t a reason to do that if it’s just a menu to choose which level to play.

Next, the solution is still the same.

Let’s say you are on the first level and then you go play it. After winning, you set a playerpref to 2. Then when you return to your level select screen, you check this value and then turn on the next button if it’s greater then the current display level(which would be level 1 since you just cleared it).

When you hit the next level button, you’ll check this value again and turn off the button since it would be equal to the current display level. You’ll basically need to check this value each time you use the next/previous buttons to check if you need to turn off the button and also when you come back to the level select scene from your game scene.

Each time you clear a new level, you’ll increment the number, but only if it’s currently equal to the level you just beat.

Yes that should result !!
But how can i do that ?