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");
}
}
}
}
↧
How to add strings in a list AND be able to save it and load it? Using playerpref OR serialization
↧