"If there is no save data" or "If there are no PlayerPrefs"

Is there anyway to code such a thing? I don’t want to do an inefficient way of something like:

if(!PlayerPrefs.GetString("Transition Slide") && !PlayerPrefs.GetString("Armor") && !PlayerPrefs.GetString("Item") && !PlayerPrefs.GetString("Weapon") && !PlayerPrefs.GetInt("Health") && !PlayerPrefs.GetInt("Money")){

…as this is just way too much and there has to be something better.

The official way of checking is:


A for loop would also speed things up:

string[] keys = new string[]{"key1","key2", etc};
for(int i = 0, i < keys.length, i++)
//Do something usefull with this info


I’m not sure I understand the question but if you’re just checking if there’s any previous playerprefs why don’t you check one playerprefs and see if it exists, if not none do. Or set one like a bool for playerPrefsExist or something. You don’t have to check every one…