//Private private void Save() { SaveFile save = new SaveFile(); foreach (KeyValuePair <Vector3Int, Block> block in world) { save.Add(block.Key, block.Value.gameObject.name); } string json = JsonUtility.ToJson(save); string path = Application.persistentDataPath + "/Save.json"; File.WriteAllText(path, json); }
public void Write(string key, object value) { if (currentSaveFile != null) { bool found = false; foreach (SaveDataRow row in currentSaveFile) { if (row.key == key) { row.value = value; found = true; break; } } if (!found) { currentSaveFile.Add(new SaveDataRow(key, value)); } } SaveToDisk(currentSaveFile); }