- Home /
dondestroyonload problem
Actually I want to make a high score board. I used the playerprefs and set it is DonDestroyOnLoad but the problem is after I finish the game, then the game will go to the scoreboard scene. If I press replay, I will go back to the game scene. Now the playerprefs is still here right. After I finish the game again and go to scoreboard scene. It will spawn one more playerprefs in my game. As a many time of this actions. Now the game have a lot of playerprefs now. So how can I destroy the past of them and keep the update version of playerpref?
Do you talk about Unity's PlayerPrefs? Because they have nothing to do with DontDestroyOnLoad...
If you talk about your own class that should save some values then just don't create another one when you still have the old one. If you placed your script on a GO in your gamescene that won't work of course. Just use a loading-scene that is only loaded once at start.
Your last sentence is even more confusing. Do you want to keep the old one or the new one? If you don't want to keep the old one, then why the hell are you using DontDestroyOnLoad?
Some code and a some explanations would be helpful, i guess...
Answer by Pong · Jul 19, 2011 at 01:51 AM
Actually I want to know how to script dun create another one when I still have the old one.
Also I want to keep the most update one of the PlayerPrefs that with a update score in it.
Sorry for my confusing question, may be I'm so tired yesterday.
Your answer
![](https://koobas.hobune.stream/wayback/20220612150249im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
HighScore Manage Using PlayerPrefs 1 Answer
How do you transfer UI Text from one scene to another? 1 Answer
PlayerPrefs Not Working 0 Answers