IEnumerator objectClosed(GameObject objectToOpen) { for (int i = 10; i >= 0; i--) { float a = (float)i / 10; objectToOpen.transform.localScale = new Vector3(a, a, 1); yield return(new WaitForSeconds(0.01f)); } objectToOpen.SetActive(false); PlayerPrefs.SetInt("intro", 1); //yield return new WaitForSeconds(0.5f); musicManager.GetComponents <AudioSource>()[2].Stop(); SceneManager.LoadScene(1); }