Hello, Is any solution how to set variables only on gamestart? I am making RPG game, and when i get into shop (separated scene), and back all variables set back on Start() function value…

void Start()
{
PlayerPrefs.SetInt (“FreePod1”, 1);
PlayerPrefs.SetInt (“FreePod2”, 1);
PlayerPrefs.SetString (“Sword1Name”, “Nothing”);
PlayerPrefs.SetString (“Sward2Name”, “Nothing”);
}
}

You can create another player prefs values that determines whether or not you should intialize the values.

So your Start would look something like…

void Start()
{
  // if the KeepValues key exists then don't reset the other values
  if (PlayerPrefs.HasKey("KeepValues")) return;

  PlayerPrefs.SetInt("FreePod1", 1);
  ...
}

When starting a new game or whatever you’ll need to delete the KeepValues key so everything will initialize.