Auto save/load question

So i have been working on getting an auto load/save to work with my current project. I put the save method that i created into the void update and that seems to work just fine with the saving, I probably don’t need it to save the information every frame, but I was not sure how to delay it for 30 seconds or a min. etc. Where I am running into issues though is when i put the auto load in the start function. If there is no save files present it just loads everything to 0, witch i understand why it does that but it actually breaks the game to have certain values start at 0. My question would be how would i set up a check to see if there is a save file present, then either load it if there is or just start the game brand new if there is not one present? I have played around with some if statements etc. trying to work this out, but so far to no avail.

Well the first we need to know how exactly you are saving the data. For example, when I save my games, I write a binary file to Application.persistentDataPath, so I would look there to see if the file exists. But your method could be completely different, I have no idea.

I am just using playerprefs currently, (have not switched over to serialization yet.) So i have a function that i made called saveallinformation and in there it sets all playerprefs. I then have a loadallinformation and it gets all the playprefs. They are connected to a save and load button right now

In that case, note two things about PlayerPrefs:

  1. You tell it what default value to use. The calls are PlayerPrefs.GetInt(“saved_int”, default_int). So if you want it to default to something other than 0, tell it something other than 0.

  2. PlayerPrefs has a HasKey() command. Just check that first.

cool thank you, i did not know there was a defualt that you could set. That should work for the issue im running into. Once i get the game about ready to move from alpha testing on the playstore to beta I will switch it over to serialized saves so that when it hits production it wont be easy to hack into etc.