Question by
EhanGoosch · Feb 22, 2019 at 01:32 AM ·
playerprefsstartupendgame
reset player prefs on start game
When I start the game, I want all player prefs to reset, but when a new scene/ the current scene is reloaded, I want the player prefs to stay the same.
Comment
Best Answer
Answer by bunnybean · Feb 22, 2019 at 04:02 AM
This is a phrase I used for keeping my music in game. This might help with your player prefs
private void Awake()
{
DontDestroyOnLoad(///prefs here);
}
That exact strategy doesn't work, but I found a way to make it work.
Ins$$anonymous$$d of holding all my stuff in player prefs, I can hold them as normal variables. This works because unity automatically resets variables when the game is started! So all I have to do to keep the variables from deleting between scenes is use DontDestroyOnLoad.
Thank You.