public static void Save(PortesArmari portesArmari) { string jsonPath = Application.persistentDataPath + "/portesArmari.json"; PortesArmariData data = new PortesArmariData(portesArmari); string json = JsonUtility.ToJson(data); File.WriteAllText(jsonPath, json); Debug.Log("Save " + json); }
private void OnEnable() { PortesArmariData portesArmari = SavePortesArmariJson.Load(); index = portesArmari.index; if (index == 1) { timeline.PlayFromTimelines(index); } }
public static PortesArmariData Load() { string jsonPath = Application.persistentDataPath + "/portesArmari.json"; if (File.Exists(jsonPath)) { string jsonRead = File.ReadAllText(jsonPath); PortesArmariData data = JsonUtility.FromJson <PortesArmariData>(jsonRead); Debug.Log("Load " + jsonRead); return(data); } else { Debug.LogError("Save file not found in" + jsonPath); return(null); } }