Hi guys,
i have public class containing settings of game graphics,i want to set new values to those variables on game start up and save them on button save,
i have no idea how to do that, even thought i checked the Docs, i couldn’t understand …
Help me plz
public class GameSettings {
public int qualitylevel;
public bool fullscreen;
public int textureQuality;
public int AA;
public int vSync;
public int resolution;
public bool realtimeReflection;
}
PlayerPrefs are ideal for these kinds of settings.
I want a text file in case the user had problem with the video problems, so he can change it outside the game, you know what i mean … ?
Yes, makes sense. Then I’d suggest using JsonUtility to convert back and forth between your class and a JSON string. And then you can use normal C# file IO classes for loading and saving.
File.ReadAllText will read text from a file into a string. File.WriteAllText will write a string out to a file. And Application.persistentDataPath is a Unity property that will give you a path safe for storing application data.
Thank you,I’ll tell you if i’m having problem