public static void SavePortaEntrada(PortaEntradaGobj portaEntradaGobj) { string jsonPath = Application.persistentDataPath + "/portaEntrada.json"; PortaEntradaData data = new PortaEntradaData(portaEntradaGobj); string json = JsonUtility.ToJson(data); File.WriteAllText(jsonPath, json); Debug.Log("Save " + json); }
private void OnEnable() { PortaEntradaData portaEntradaData = SaveAnimationsStateJson.LoadPortaEntrada(); index = portaEntradaData.index; if (timeline != null && index == 1) { timeline.PlayFromTimelines(index); } }
public static PortaEntradaData LoadPortaEntrada() { string jsonPath = Application.persistentDataPath + "/portaEntrada.json"; if (File.Exists(jsonPath)) { string jsonRead = File.ReadAllText(jsonPath); PortaEntradaData data = JsonUtility.FromJson <PortaEntradaData>(jsonRead); Debug.Log("Load " + jsonRead); return(data); } else { Debug.LogError("Save file not found in" + jsonPath); return(null); } }