Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Hi, i need help with restarting the game

Discussion in 'Scripting' started by Silvaantonio, Apr 29, 2021.

  1. Silvaantonio

    Silvaantonio

    Joined:
    Apr 29, 2021
    Posts:
    9
    Hi, im new how do you restart the game, i currently have this
    Code (CSharp):
    1.     void Win ()
    2.     {
    3.         Time.timeScale = 1f;
    4.         UI.instance.SetEndText(true);
    5.         SceneManager.LoadScene("Game");
    6.     }
    7.  
    8.     // called if the remaining time on a problem reaches 0
    9.     void Lose ()
    10.     {
    11.         Time.timeScale = 1f;
    12.         UI.instance.SetEndText(false);
    13.         SceneManager.LoadScene("Game");
    14.     }
    I want it to show the text wait like 2 seconds and restart, ty in advance
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,756
  3. Silvaantonio

    Silvaantonio

    Joined:
    Apr 29, 2021
    Posts:
    9