//Exit to menu or whatever void finishGame() { ReadAndWriteStats statsManager = GetComponent <ReadAndWriteStats>(); statsManager.gamesPlayed++; statsManager.writeStats(); //Reset node count NodeGenerator.numNodes = 0; NodeGenerator.numDepthReached = 0; SceneManager.LoadScene("Menu"); }
//Exit to menu or whatever void finishGame() { ReadAndWriteStats statsManager = GetComponent <ReadAndWriteStats>(); statsManager.gamesPlayed++; statsManager.writeStats(); //Send end game message to server GameObject networkGameObject = GameObject.Find("ConnectionHandler"); //Go back to menu if offline. If online, go back to the lobby? if (networkGameObject == null) { SceneManager.LoadScene("Menu"); } else { //Wait for message to change scene } }