void Start() { filePath = Application.dataPath + dataProjectFilePath + mechListTargetPath + (".json"); jsonAsData = File.ReadAllText(filePath); mechArray = JsonUtility.FromJson <MechArray>(jsonAsData); LoadList(); }
void LoadData() { string filePath = Application.dataPath + dataProjectFilePath + targetFile + (".json"); if (File.Exists(filePath)) { string jsonAsData = File.ReadAllText(filePath); switch (windowState) { case 0: mechData = JsonUtility.FromJson <MechData>(jsonAsData); break; case 1: componentLoadout = JsonUtility.FromJson <ComponentLoadout>(jsonAsData); break; case 2: mechArray = JsonUtility.FromJson <MechArray>(jsonAsData); break; } } else { mechData = new MechData(); } }