// Start is called before the first frame update void Start() { JsonPath = Application.dataPath + "/StreamingAssets/HighScores.json"; if (!File.Exists(JsonPath)) { Jsonfile = JsonUtility.ToJson(HighScores); File.WriteAllText(JsonPath, Jsonfile); } else { Jsonfile = File.ReadAllText(JsonPath); HighScores = JsonUtility.FromJson <allScores>(Jsonfile); } }
private void Start() { player1 = GameObject.FindGameObjectWithTag("Player 1"); player2 = GameObject.FindGameObjectWithTag("Player 2"); game_finished = false; JsonPath = Application.dataPath + "/StreamingAssets/HighScores.json"; if (!File.Exists(JsonPath)) { Jsonfile = JsonUtility.ToJson(HighScores); File.WriteAllText(JsonPath, Jsonfile); } else { Jsonfile = File.ReadAllText(JsonPath); HighScores = JsonUtility.FromJson <allScores>(Jsonfile); } }