Level select screen unlock on completion of game

Hi, I have made a level select screen for my game. (on my main menu I have “new game” “level select” and “quit”.

What I want to do is have it so that the level select is greyed out and once the player completes the game once it unlocks so they can choose any level to play.

How would I go about doing this?

use playerprefs to save a key at the ending of the game.

and make the level select button enable if the playerpref key is found. so until the game is completed for first time the key wont be saved, hence the level selection wont be unlocked till then.

you would have the code for checking last level completion rite in tht place you have to add this code PlayerPrefs.SetInt("gameOver",1);

and in the menu screen you have to check for this value,

 function OnGUI()
    {
    
        if(PlayerPrefs.GetInt("gameOver")==1)
        {
          //here make the button active.  btw you have to use different texture for active and inactive states.
        }
        else
        {
          // draw inactive texture. and also  dont take input (you can notify if u want, infact tht would be better.)
        }
    }

FYI: the PlayerPrefs.GetInt() function will return 0 if key is not found. if this is still not clear just post your menu code, ill edit it for u