Mobile: Is there a way to write PlayerPref data on first install

Hello,

I am using PlayerPrefs for local scoreboard/options for my game. I would like to set a default name as well as default music volume. I could think of one way of doing this which would be to create an empty string value “First” and write the following code on the Start() method of one of my scripts:

if (PlayerPrefs.GetString("First") == "")
        {
            //set default prefs
            PlayerPrefs.SetString("First", ".");
        }

I was wondering if this is the “correct way” of doing this, or if there is a conventional method?

Thanks!

What about PlayerPrefs.HasKey?
Store the name in the player prefs and use HasKey to check if it exists, if not then do your init.