public void LoadIt() { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); string json = PlayerPrefs.GetString("Save"); myObject = JsonUtility.FromJson <SaveJson.MyClass>(json); /* * Debug.Log(myObject.playerName); * Debug.Log(myObject.score); * PlayerPrefs.SetString("Name", myObject.playerName); * PlayerPrefs.SetInt("score", myObject.score); * PlayerPrefs.SetFloat("rotatorspeed", myObject.rotatorSpeed); * PlayerPrefs.SetInt("lives", myObject.lives); * PlayerPrefs.SetFloat("pinspeed", myObject.pinSpeed); * PlayerPrefs.SetFloat("time", myObject.time); */ NameText.userIDs = myObject.playerName; Score.PinCount = myObject.score; altScore = myObject.score; RotatorSpeed.rotatorSpeed = myObject.rotatorSpeed; GameManager.lives = myObject.lives; altLives = myObject.lives; PinSpeed.pinSpeed = myObject.pinSpeed; //expo6 = myObject.music; PlayerPrefs.Save(); expo2 = true; }
public void LoadIt() { //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); string json = PlayerPrefs.GetString("Save"); myObject = JsonUtility.FromJson <SaveJson.MyClass>(json); NameText.userIDs = myObject.playerName; WordDisplay.score = myObject.score; DropD1.lives = myObject.difficulty; difficulty2 = myObject.difficulty; //altScore = myObject.score; //RotatorSpeed.rotatorSpeed = myObject.rotatorSpeed; // GameManager.lives = myObject.lives; // altLives = myObject.lives; //PinSpeed.pinSpeed = myObject.pinSpeed; //expo6 = myObject.music; PlayerPrefs.Save(); expo2 = 1; }