Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

How to add strings in a list AND be able to save it and load it? Using playerpref OR serialization

$
0
0
I been searching this for a while and I am not moving forward at all. Any comment will help. So it you guys have any ideas just comment it. I tried to do one with playerPref, (Below is the code), BUT It is not working. public List Levelnames= new List(); void Start() { for (int i = 0; i < Levelnames.Count; i++) { if (PlayerPrefs.HasKey("levels" + i)) { PlayerPrefs.GetString("levels" + i, Levelnames[i]); print("load"); } } void Update() { if (Input.GetKeyDown(KeyCode.Q)) { Levelnames.Add("levels"); for (int i = 0; i < Levelnames.Count; i++) { if (!PlayerPrefs.HasKey("levels" + i)) { PlayerPrefs.SetString("levels" + i, Levelnames[i]); print("save"); } } } }

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>