|
Basically i have a piece of code that captures a players score and is then used later to show the score. The problem i am having though is the fact that when a player resets the level the player pref is not deleting even though i have a code telling it to do so: PlayerPrefs.DeleteKey("Player Score"); PlayerPrefs.SetFloat("Player Score", score); The above script shows that i am deleting the playerpref before allowing the player to store it again however it is now working.
(comments are locked)
|
|
You're just deleting the key and then immediately writing it again. This will have the same effect as not deleting it at all. If you want the key to be deleted, then don't write it again. The delete key is there to remove any previous data so that a new float can be stored. The reason behind this is so that when a player restarts a level the score can be overwritten
May 13 '11 at 10:45 AM
Aaron Ratcliffe
@Aaron Ratcliffe: you don't need to do that. Just do SetFloat again and the previous value is overwritten.
May 13 '11 at 09:17 PM
Eric5h5
oh ok haha, was sure i tired that and it didnt work. Ill give it another go
May 14 '11 at 10:25 PM
Aaron Ratcliffe
Just realised why it wasnt working. I was attempting to save the playerpref during an impossible if statment... /facepalm. Thanks for the help people
May 14 '11 at 10:38 PM
Aaron Ratcliffe
(comments are locked)
|
|
Make a -1, and then when you up to the server, just have it check if it's <0, if so, then dont do it, if so, then do it.
(comments are locked)
|
