Y
Y
yraiv2020-05-05 20:20:36
Unity
yraiv, 2020-05-05 20:20:36

I can't create a save method using playerprefs, what should I do?

Swears at how I call the key. Namely, on LvlNomer, he writes that it does not exist in this context. How to declare a key name then?

public void Save()
    {
        string key = “LvlNomer”;
        PlayerPrefs.SetInt(key, this.lvl);
        PlayerPrefs.Save();
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OblivionGM, 2020-05-05
@yraiv

Answer from user GavriKos:
In the line string key = “LvlNomer”; incorrect quotes, that was the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question