private void LoadKeyData() { string filePath = Application.streamingAssetsPath + keyDataFile; if (File.Exists(filePath)) { string dataAsJson = File.ReadAllText(filePath); data = JsonUtility.FromJson <KeyData>(dataAsJson); if (data != null) { for (int i = 0; i < data.Keys.Length; i++) { SetKeyAt(i + 1, data.Keys[i]); } } } else { File.Create(filePath); } }
private void Start() { Instance = this; data = new KeyData(); LoadKeyData(); }