How to change level after my game over screen appears? C#

Hello, I am creating game with use of a master script. Inside my Game Over Script I would like for the first level to be loaded Blank number of seconds after the Game Over Panel is set to true. When I try this my “void TurnOnGameOverPanel()” gives and error “cannot be an iterator block because `void’ is not an iterator interface type”. Can anyone help me out on this one? Thanks

P.S. I know my script is correct but it’s my best shot at it and I’d stuck. It’s in C# by the way. :slight_smile:

 public class GameManager_Frank_GameOver : MonoBehaviour
    {
        private GameManager_Frank_Master gameManagerMaster;
        private Player_Master playerMaster;
        public GameObject panelGameOver;


        void OnEnable()

        {
            SetInitalReferecnes();
            {

                gameManagerMaster.GameOverEvent += TurnOnGameOverPanel;

            }

        }

        void OnDisable()

        {
            gameManagerMaster.GameOverEvent -= TurnOnGameOverPanel;

        }

        void SetInitalReferecnes()
        {
            gameManagerMaster = GetComponent<GameManager_Frank_Master>();
        } 

        void TurnOnGameOverPanel()

        {
            if (panelGameOver != null)
            {

                panelGameOver.SetActive(true);
                yield return new WaitForSeconds(6);
                Application.LoadLevel(1);
            }
        }

    }
}

you have to use a IEnumerator for waitforseconds:

     IEnumerator TurnOnGameOverPanel()
    {
    if (panelGameOver != null)
             {
 
                 panelGameOver.SetActive(true);
                 yield return new WaitForSeconds(6);
                 Application.LoadLevel(1);
             }
    }

And you have to start it:

StartCoroutine(TurnOnGameOverPanel());

Link info: Unity - Scripting API: Coroutine
Unity Manual