public static void DumpUsers() // dump users into the system(json file) and console { userData newUsers = new userData(); // new users string path = Application.streamingAssetsPath + "/UserData.json"; // path to system foreach (User user in users.Values) { newUsers.Add(user); // add user to userData } Debug.Log(JsonUtility.ToJson(newUsers)); // show system on console File.WriteAllText(path, JsonUtility.ToJson(newUsers)); // add users to system }
public static void DumpUsers() { userData newUsers = new userData(); string path = Application.streamingAssetsPath + "/userData.json"; foreach (User user in users.Values) { newUsers.Add(user); } Debug.Log(JsonUtility.ToJson(newUsers)); File.WriteAllText(path, JsonUtility.ToJson(newUsers)); }
// This function is to modify or add users to the JSON file public static void dumpTKL() { userData nUsers = new userData(); // File path to user data string filepath = Application.streamingAssetsPath + "/userData.json"; // Add user modifications or new users to the JSON file foreach (User user in users.Values) { nUsers.Add(user); } //Debug.Log(JsonUtility.ToJson(nUsers)); File.WriteAllText(filepath, JsonUtility.ToJson(nUsers)); }