public Profile(ProfileData data) { if (data.name != null) this.name = data.name; if (data.age != null) this.age = data.age; if (data.difficulty != null) this.difficulty = data.difficulty; if (data.picture != null) this.picture = data.picture; }
public void Save() { if (CurrentProfile == null) return; BinaryFormatter bf = new BinaryFormatter (); FileStream file = File.Create(Application.persistentDataPath + "/"+CurrentProfile.name+".dat"); ProfileData data = new ProfileData (); data.Fill (CurrentProfile); bf.Serialize(file, data); file.Close(); }