Skip to content
Snippets Groups Projects
Commit e201cf1c authored by Kent Holt's avatar Kent Holt
Browse files

Fixed typo

parent a2560e64
No related branches found
No related tags found
Loading
...@@ -21,6 +21,24 @@ public class CityGenWindow : EditorWindow ...@@ -21,6 +21,24 @@ public class CityGenWindow : EditorWindow
GUILayout.EndScrollView(); GUILayout.EndScrollView();
} }
// Save the data about city.
void save (string fileName = "data") {
// Covert city object to json.
string cityDataAsJson = JsonUtility.ToJson(this.city);
//print(Application.persistentDataPath + this.jsonFilePath);
// Creates a directory in local disk.
System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/CityData");
// Write all the data to a file.
System.IO.File.WriteAllText(Application.persistentDataPath + this.jsonFilePath, cityDataAsJson);
}
// Load the data about city.
void load(){
string cityDataAsJson = System.IO.File.ReadAllText(Application.persistentDataPath + this.jsonFilePath);
city = JsonUtility.FromJson<City>(cityDataAsJson);
}
// ######### Container Classes ######### // ######### Container Classes #########
private class CityEntry private class CityEntry
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment