- Home /
Executing code from a text file and writing changes to it
I have a text file that contains some variables in the form of an options.ini file
bloom=1
treeDistance=2000
i have already initialised the variables and i want to make the game execute the text file so var1 and 2 get their values from inside it (i use it for saving options) And also if a variable changes ,how can i store its new value next to its name in the text file
Answer by cncguy · Jul 15, 2010 at 10:40 AM
I have a feeling that you should look at playerprefs. See the unity scripting documentation for playerprefs. http://unity3d.com/support/documentation/ScriptReference/PlayerPrefs.html Eg.
PlayerPrefs.SetInt("Bloom", 10);
and
localBloom = PlayerPrefs.GetInt("Bloom");
Basically it eli$$anonymous$$ates the need for a text file to be exact because ti uses the registry but nonetheless its working as i wanted it to
Your answer
Follow this Question
Related Questions
Loading text into Gui.Box 2 Answers
Load and save text from web server 2 Answers
How do I load a 60mb text file? 0 Answers
Trouble creating a text file 4 Answers
How to get info from a text file 1 Answer