public void SaveGameToJsonFile() { GameSave gameSave = new GameSave(); // get player data and set to serializable structs PlayerStruct playerStruct = PlayerManager.instance.player.ToPlayerStruct(); gameSave.SetPlayer(playerStruct); // get block data and set to serializable structs foreach (Block b in BlockManager.instance.GetBlocksAsList()) { BlockStruct blockStruct = b.ToBlockStruct(); gameSave.AddBlock(blockStruct); } // commit the save data string json = JsonUtility.ToJson(gameSave); // print("save game to file..."); // print("json to save: " + json); // print("path to save: " + GetSavePath()); File.WriteAllText(GetSavePath(), json, Encoding.UTF8); }