public IEnumerator loadChunk(string numChunk) { string destination = Application.persistentDataPath + "/Data/" + numChunk + ".data"; dataChunkSave data = JsonUtility.FromJson <dataChunkSave>(File.ReadAllText(destination)); posChunk = data.posChunk; blocks = data.blocks; nameChunk = data.nameChunk; yield return(null); }
public IEnumerator saveChunk(string numChunk) { dataChunkSave obj = new dataChunkSave(); obj.blocks = blocks; obj.posChunk = posChunk; obj.nameChunk = nameChunk; string json = JsonUtility.ToJson(obj); string destination = Application.persistentDataPath + "/Data/" + numChunk + ".data"; File.WriteAllText(destination, json); yield return(null); }