//----------------------------------------------------------------------------------------------------------------------------------------------// private void LoadOnboard() { if (File.Exists(Application.persistentDataPath + "/" + this.gameObject.name + ".dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/" + this.gameObject.name + ".dat", FileMode.Open); OnboardConfirmation info = (OnboardConfirmation)bf.Deserialize(file); file.Close(); if (info.onboarded == true) { // Close Onboard Screen this.gameObject.SetActive(false); } else { // Open Onboard Screen this.gameObject.SetActive(true); } } else { // Open Onboard Screen this.gameObject.SetActive(true); } }
//----------------------------------------------------------------------------------------------------------------------------------------------// private void SaveOnboard() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/" + this.gameObject.name + ".dat"); OnboardConfirmation info = new OnboardConfirmation(); info.onboarded = true; bf.Serialize(file, info); file.Close(); }