i made a game like temple run but when i fall from edge it loads restart menu but the score keep going
public class gamemanager : MonoBehaviour { bool gameover; public float restartdelay = 1f; //for linking restart menu and gamemanager public restartmenu restartmenu; public void endgame() {if (gameover == false) { gameover = true; Invoke ( "restart",restartdelay ); }
}
void restart()
{
restartmenu.togglerestartmenu();
}
Answer by kennenwe · Jan 29, 2018 at 06:46 PM
Restart the whole scene and it will restart everything(player position, score, money, etc)
using UnityEngine.SceneManagement;
void restart() { SceneManager.LoadScene(SceneManager.GetActiveScene().name); }
or if you want to load the menu use
SceneManager.LoadScene(SceneManager.GetActiveScene("TheSceneMenuName"));,Just restart the scene and It will restart everything(position, score, money etc) using UnityEngine.SceneManagement;
void restart() { SceneManager.LoadScene(SceneManager.GetActiveScene().name) }
and if you have a problem with the lighting stop the auto generate in the lighting window and then click generate