public void SaveScriptInJSON() { NumberForJson number = new NumberForJson(); number.Current = int.Parse(InputBox.text); string json = JsonUtility.ToJson(number); File.WriteAllText(Application.dataPath + "Number.json", json); }
public void WriteCurrentInTextFromJson() { try { string json = File.ReadAllText(Application.dataPath + "Number.json"); NumberForJson number = JsonUtility.FromJson <NumberForJson>(json); current.text = "Current Number:" + number.Current; } catch (System.Exception e) { Debug.Log(e.Message); } }