//This method will reset the variable of all the apples GameObject in the list appleList. private void ResetInList() { Debug.Log("ResetInList"); foreach (GameObject apple in appleList) { //Check if the variable isn't null if (apple != null) { //Handler to AppleCycle script AppleCycle appleCycle = apple.GetComponent <AppleCycle>(); appleCycle.inList = false; //Test if the apple needed to be destroyed or no. appleCycle.appleChange(); } } CleanList(); }