- Home /
Question by
Suhrahj · Jan 02, 2017 at 11:41 AM ·
serializationsaveloadstaticstatic-function
Saving and Loading with a static or a local function
I am somewhat new to all this, so I wanted to get some opinions. I have been looking at various examples on how to save variables. I am talking about serialization ant not PlayerPrefs. Which is the best practice? Should I just create a static function in a static class to save and load my data or use local functions wherever I need it? Or does it even matter which one I choose to do?
Comment
Of course it doesn't matter as long as it works for you. However, it's advisable to create save and load functions that can be used in flexible ways, so a static function would not be a bad idea. Ideally, you only have one save and one load function which uses a BinaryFormatter to write or read a file.