Dumb question but I want my game to be secure as possible. Right now I have classes interfacing with each other in order to save/load player information. Right now I have all the variables in my classes as public, and saving / loading the saved variables into them. But I don't think that's as secure.
Code:
public class PlayerRP : MonoBehaviour {
public string charName;
public string charRace;
public string charClass;
public string charClassSpec;
public string charBackground;
public string charGender;
}
public class CharacterManager : MonoBehaviour {
public void SaveCharacter() {
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath + slotFile);
CharacterSaveFile data = new CharacterSaveFile();
// Character RP
data.charName = playerRP.charName;
data.charRace = playerRP.charRace;
data.charClass = playerRP.charClass;
data.charGender = playerRP.charGender;
bf.Serialize(file, data);
file.Close();
LoadCharacter();
}
}
Would it be safer (or more efficient) to instead make methods in the playerRP class to get/set the variables separately, rather than have them as public?