How can I make this GameObjects array remain permanent when i activate?

Hello, I have an EmptyObject with a code (see below the text) that is linked to 3 more EmptyObjects. The idea is that when you start the level the first Emptyobject will be activated while the other 2 will be deactivated and when you restarted the level for the first time EmptyObject first and second will be activated while third not. Moreover, the second time that you restart the level all three EmptyObject will be activated.

Now, when I restart for the second time, the third EmptyObject is activated and the second EmptyObject is deactivated.


	public AudioSource Audio;
	public GameObject[] Level_M;
	public int Min = 0;

	// Use this for initialization
	public void Start () {

		Min = PlayerPrefs.GetInt("Min");

		if (Min <= Level_M.Length)
			Min = Min + 1;
		PlayerPrefs.SetInt("Min", Min);
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown(KeyCode .Space)) 
			SceneManager.LoadScene ("AudioManager");
			Debug.Log ("RESET!");

Each time you restart your game, you’re only activating ONE GameObject through your code.

If I understood correctly what you want, the solution would be to LOOP through your GameObject[] until Min and not only activate the GameObject at Min.

Follows below a sample code that would do it.

int min = PlayerPrefs.GetInt("Min");

for (int i = 0; i <= min; i++) {

PlayerPrefs.SetInt("Min", min + 1);