- Home /
PlayerPrefs issue
ok, so I have a script that auto saves the players position, and then when the player uses a UI on the main menu "Continue" it will put them at the point where the position was auto saved. The issue is that also have a "New Game" button, and it doesn't work right? It just loads the saved PlayerPrefs. How can I make a new game start point for the player when they use that UI?
any help is welcomed.
thank you.
Answer by bunnynsnake · Apr 17, 2018 at 01:48 PM
figured it out. I did this code and it fixed everything.
Private Void LoadScene ()
{
PlayerPrefs.DeleteAll();
SceneManager.LoadScene("L1");
}
Answer by melsy · Apr 17, 2018 at 03:47 AM
Have a start position on the map and when the New game is pressed and the player is being loaded into the scene, have the playerPref for the position go to the start position instead of the saved position.
basically overwrite the saved position with the start position.
ok, but i also have playerperfs that are saving triggers that are destroyed and objects that are set active. how would i have all the reset when they hit new game?