I need help restarting the scene and I also the gui button wont work i need help restart the whole scene i dont have a Script because non of them work also im working in a 3D
plz help
I need help restarting the scene and I also the gui button wont work i need help restart the whole scene i dont have a Script because non of them work also im working in a 3D
plz help
The easiest option would be to use SceneManager.LoadScene()
And to restart the level, all you really need to do is load the same scene.
import UnityEngine.SceneManagement; //So you can use SceneManager
function Start () {
}
function Update () {
if (Input.GetKeyDown("r")) { //If you press R
SceneManager.LoadScene("Game"); //Load scene called Game
}
}
Hope that helps!
put this function OnClick Event of Your Restart button
public void OnRestarButtonClick(){
Application.LoadLevel (Application.loadedLevel);
}
,put this function on button OnClick Event
public void OnRestartButtonClick(){
Application.LoadLevel (Application.loadedLevel)
}