public void ContinueGame() { SoundManager.instance.StopSound(); string json1 = File.ReadAllText(Application.dataPath + "/lastPos.json"); lastPos position = JsonUtility.FromJson <lastPos>(json1); playerMovement.loadPosition(position.pos); spawnPoint.ifToSpawn(false); PauseMenu.GameIsPaused = false; SceneManager.LoadScene(position.scene); Cursor.visible = false; }
public void MainMenu() { Scene currentScene = SceneManager.GetActiveScene(); lastPos position = new lastPos(); position.pos = rb.position; position.scene = currentScene.name; string json = JsonUtility.ToJson(position); File.WriteAllText(Application.dataPath + "/lastPos.json", json); Time.timeScale = 1; SceneManager.LoadScene("Menu"); }