Reputation: 3
I have a problem on my restart button. My game is about catching things, when I catch a thing, the score is 1, if I catch a lot of things, score is like 10-11 (whatever), when I press the restart level button, the score is same, I mean 10-11, he is not restarting. I use PlayerPrefs, this is saving my score. And, If I press the next level button, the score is ok, but when I catch again things, in the new level, if I try to restart the level, the score is not the same like when the level start, score remain.
Is there a way to do, when I press the restart button and level starts again, the score to be like the first time?
Upvotes: 0
Views: 204
Reputation: 1050
You need to reset your PlayerPrefs.
Let's say your score is saved like so: PlayerPrefs.SetInt("Score", score);
.
When you restart the level you should reset this "Score" aswell: PlayerPrefs.SetInt("Score", 0);
Upvotes: 1