void Update() { if (Credits.Count != 0) { //move word "credits" up once credits cross middle of screen if (Credits[0].transform.localPosition.y > 0) { if (creditsText.rectTransform.anchoredPosition3D.y < creditsText.rectTransform.rect.height) { creditsText.transform.Translate(Vector3.up * Time.deltaTime * speed); } } //move credits up for (int i = 0; i < Credits.Count; i++) { Credits[i].transform.Translate(Vector3.up * Time.deltaTime * speed); //once credits reach the top, destroy them if (Credits[i].transform.localPosition.y > top.transform.localPosition.y) { Destroy(Credits[i].gameObject); Credits.RemoveAt(i); } } } else if (isActiveAndEnabled) { //restart game once credits finish rolling if (Manager.Instance.gameOver) { Manager.Instance.gameOver = false; SceneManager.LoadScene(0); } nav.goToMainMenu(); } }