Question by
gss214 · Sep 12, 2015 at 11:04 PM ·
playerprefsvalue
how to save a value and add, like a statistics
I have playerprefs how many popcorn caught during the game, I put the value in a scene. But when I play again and die, instead of adding to the value that was already it replaces.
example:
pipocasPerdidasNP = PlayerPrefs.GetInt ("pipocasGPE"); // I want every game add value,, if I caught 9 in the game and grabbed 10 in another game, one had to show 19
Comment
Best Answer
Answer by hexagonius · Sep 13, 2015 at 08:14 AM
start of the game:
int currentScore = efs.GetInt ("pipocasGPE");
during game:
currentScore += additionalScore;
end game:
efs.SetInt ("pipocasGPE", cureentScore);
Your answer