public void Load() { if (File.Exists(Application.dataPath + "/matchData.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.dataPath + "/matchData.dat", FileMode.Open); Infoo info = (Infoo)bf.Deserialize(file); file.Close(); scoreToWin = info.scoreToWin; sceneToLoad = info.levelToLoad; Debug.Log("Loaded"); } }
public void HostSave() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.dataPath + "/matchData.dat"); Infoo inf = new Infoo(); if (gameObject.GetComponent <Canvas>() != null) { inf.scoreToWin = int.Parse(transform.GetComponentInChildren <InputField> ().text); inf.levelToLoad = transform.GetComponentInChildren <Dropdown> ().captionText.text; } bf.Serialize(file, inf); Debug.Log("Saved"); file.Close(); }
public void Awake() { S = this; }