Hey I am having a problem saving the value of a variable. I have an int variable named healthCounter and after I update the variables value, I call the line of code
This should save the current value of healthCounter so that when I run the program the next time when I call the line of code
healthCounter = PlayerPrefs.GetInt("health");
this should update the value of healthCounter to what it was before I closed the program right? Instead though it sets healthCounter as the default value of PlayerPrefs.GetInt which is 0. Does anyone know how to fix this? Any insight would be greatly appreciated.
asked Jan 13 '10 at 03:45 AM
As far as I can see, your code should work exactly as you expect, as written. So I'm guessing the problem may lie somewhere else. Perhaps you could post a larger portion of your code, and provide more detail about how you know that your code is being called in the correct order, and that healthCounter really is receiving the value zero.
answered Jan 13 '10 at 08:19 AM