public void LoadGameDataFromFile(string filename = "/gamesave.txt") { StreamReader file = new StreamReader(Application.dataPath + filename); string load = file.ReadToEnd(); file.Close(); GameData = JsonUtility.FromJson <UrbSave>(load); }
public void CollectGameData() { if (Maps == null || Maps.Count <= 0) { Debug.LogError("Missing Reference to UrbMap, Cannot collect Game Data"); return; } if (AgentTypes == null || AgentTypes.Count <= 0) { Debug.LogError("Missing UrbAgent Prefab Key, Cannot collect Game Data"); return; } GameData = new UrbSave { Maps = new UrbMapData[Maps.Count], OffsetTime = CurrentTime }; for (int i = 0; i < Maps.Count; i++) { GameData.Maps[i] = Maps[i].GetMapData(); } }