Setting Default PlayerPrefs on First Run?

I’m making a game for android, and am working on saving settings that the player will set. I’m using the playerPrefs object to save these between runs, but I have no idea how to set default settings.

Is there a way for me to set default playerPrefs without overwriting previous settings each time the game is run?

Thanks!

Use the version of the PlayerPrefs functions that includes a default value.

// Set music volume to 0.5 by default if this is the first run
var musicVolume = PlayerPrefs.GetFloat ("MusicVolume", 0.5);