Locked levels

In my game, I have couple of levels. At the beginning of the game, I want all of them to be locked, except the first one. At the same time I want the locked levels to have different picture than the unlocked ones (this will probably be done with GUI).

How can I do this?

I have the following code in my scene with level map:

public Texture2D level2_Locked;
public Texture2D level2_Unlocked;
public Texture2D level3_Locked;
public Texture2D level3_Unlocked;

public int levelReached = 0;
levelReached = PlayerPrefs.GetInt("SavedLevel");

void OnGUI () {

	if(levelReached == 2)
	{
		GUI.Label (new Rect (500,300,50,40),level2_Unlocked);
	}

	else if(levelReached == 1)
	{
		GUI.Label (new Rect (500,300,50,40),level2_Locked);
	}
	if(levelReached == 3)
	{
		GUI.Label (new Rect (500,300,50,40),level3_Unlocked);
	}
	
	else if(levelReached == 0)
	{
		GUI.Label (new Rect (500,300,50,40),level3_Locked);
	}

}

}

And I have PlayerPrefs.SetInt(“SavedLevel”, 3); in other script. Is it possible to have sth like this?

Make a new object called “LevelIcon” that contains the 2 textures (locked/unlocked), an int property for index and maybe a property “LevelName”, for the display name.

Build an Array of such objects, adding an object for each level. In your GUI function, loop through the array, and if the index is < levelReached, show the unlocked texture, else, show the locked one.