- Home /
Question by
teneadenis · Feb 10, 2020 at 11:35 PM ·
restartrestart game
Restart Game from Button, not SceneMangement
Hi guys! Is there any command where I could restart the game completely. I don't want to use scene management to get me to the first scene. I was thinking if there would be any re start option in the engine.
Comment
The only way (I am aware of) is using Scene$$anonymous$$anagement, why would you not want to use it ?
Answer by williamtjy · Feb 11, 2020 at 04:21 AM
If you're only using UI for your game, you can make an Init function to reset all the values to default. Otherwise, SceneManagement is the best scenario to restart the game.
Put this OnClick function on your Restart button
public void OnRestartButton(){
SceneManager.LoadScene("FirstScene"); //Place the name of your first scene here
}