Hi
After updating to 5.5.0 version, my save script did not work !! No error at all but not loading game save file ?
I checked docu page, nothing about “file.create” ?!
using UnityEngine;
using System.Collections;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using UnityEngine.UI;
public class saveload : MonoBehaviour {
private gamethings dr;
void Awake()
{
dr = GameObject.FindObjectOfType<gamethings>();
}
void Start () {
Load_game_end();
}
public void Save_game_end()
{
BinaryFormatter bf = new BinaryFormatter();
FileStream data_file = File.Create(Application.persistentDataPath + "/Gworlds.datt");
eat_things data = new eat_things();
data.level1t = dr.level1t;
bf.Serialize(data_file, data);
data_file.Close();
Debug.Log("Game full saved");
}
public void Load_game_end()
{
if (File.Exists (Application.persistentDataPath + "/Gworlds.datt"))
{
BinaryFormatter bf = new BinaryFormatter();
FileStream data_file = File.Open (Application.persistentDataPath + "/Gworlds.datt", FileMode.Open);
eat_things data = (eat_things)bf.Deserialize(data_file);
data_file.Close();
dr.level1t= data.level1t;
Debug.Log("Game full loaded");
}
else{
Debug.Log("save not found");
}
}
public void delete_save_file() {
File.Delete(Application.persistentDataPath +"/Gworlds.datt");
}
[Serializable]
class eat_things
public float level1t;
}
}
So, where is the problem ?