- Home /
Saving data
Hello. I'm sorry but at this point I don't know what to do. I searched everything. I have found some solutions but I need your help. In my game I have a SaveManager script in C#. I have 2 variables (Level and Skin [and they are int]). These variables always keep track of 2 static variables. I have also 2 functions (Void Save() and Void Load()). Now I want to save those 2 variables in a file whenever I call the function "Save()" and when open again the game using the Load() function to replace the existing data with the one saved before. I NEED THIS WAY TO WORK FOR ANDROID. I don't care which method to use but please make it as simple as possible because I am new to saving data. Your help is appreciated!!!
Answer by FreakinKaT · May 04, 2020 at 11:35 AM
A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced. A static constructor will run before an instance constructor. A type's static constructor is called when a static method assigned to an event or a delegate is invoked and not when it is assigned. If static field variable initializers are present in the class of the static constructor, they will be executed in the textual order in which they appear in the class declaration immediately prior to the execution of the static constructor. If you don't provide a static constructor to initialize static fields, all static fields are initialized to their default value.
Your answer
Follow this Question
Related Questions
PlayerPrefs file wrong stored location 0 Answers
How to manually edit player prefs file on android ? 1 Answer
Exporting XML files to Android 1 Answer