- Home /
Best way to save data
Hello, I've been wondering... What's the best way to save data in games? Maybe with JSONs? If so, how do I use it. The only way I ever saved data was making many .txt files and each of them store data then for example, let's say I wanted to save the variable "currentWood". I would write to a text file the "currentWood.ToString();", I would load it by reading from the text file and converting the string to an int. But it was way too many since I was making a survival game and I had to make a text file for each variable. (example: currentWood, currentAxe, currentStone, currentMeat, etc). So... what's the best way to save data?
I can suggest taking a look at my free SerializeHelper asset that is aimed at $$anonymous$$ching the basics of data saving & loading.
Answer by Fattie · Dec 23, 2015 at 12:13 AM
this is completely builtin to unity and very easy to use
http://docs.unity3d.com/ScriptReference/PlayerPrefs.html
1000s of QA on here about it, enjoy
Thanks! Will this work with all types of variables? Vector3's to save position and floats, ints etc?
click and read doco, cheers.
open google type "unity3d save Vector3 PlayerPrefs"
Your answer
![](https://koobas.hobune.stream/wayback/20220612053603im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to Save Objects that were added into the scene at runtime 2 Answers
How to use StreamReader in my case 1 Answer
Multiple Cars not working 1 Answer
Persistent data, Save file doesn't come out as hoped 1 Answer
Distribute terrain in zones 3 Answers