public void RestartGame() { mainMenu.SetActive(true); gameStarted = false; gameOver = false; playerActive = false; // Reset the positions of the objects for (int i = 0; i < gameElements.Count; i++) { PlatformObject element = gameElements [i]; element.ResetToInitialPosition(); } player.ResetToStartPosition(); }