Save writes a temp file and ignores saves from there

Discussion and help for Easy Save 3
Post Reply
kprime
Posts: 5
Joined: Sat Jun 01, 2019 2:50 am

Save writes a temp file and ignores saves from there

Post by kprime »

Hi,

So we are working on a game where there are save points in the game. Much like an automatic saving system in a walking simulator. It worked completely fine in the editor, but in the built version of the game, there are a few save points that work, but occasionally I would have a save trigger that saves, but saves a .tmp file next to the original save data. And I know that .tmp used for like a safeguard in case people crash while saving, but after the .tmp file is created, my original save data is completely ignored when i try to load them. Any ideas?

Thanks,

kprime
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save writes a temp file and ignores saves from there

Post by Joel »

Hi there,

If the temp file is persisting, this signifies that an error occurred during saving. You should take a look at the log file, as an exception should be outputted which will tell you what the issue is.

Note that if you've put your Easy Save code in a try/catch statement, this will hide the error, so you will need to make sure that exceptions are re-thrown after they are caught if you want to debug the issue.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
kprime
Posts: 5
Joined: Sat Jun 01, 2019 2:50 am

Re: Save writes a temp file and ignores saves from there

Post by kprime »

In that case, how can i access the temp file? just say in the code:

if "savedata.txt.tmp" exists then get information from there?
kprime
Posts: 5
Joined: Sat Jun 01, 2019 2:50 am

Re: Save writes a temp file and ignores saves from there

Post by kprime »

Ok seems like i cannot access the temp file.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save writes a temp file and ignores saves from there

Post by Joel »

Hi there,

The temp file is not a backup file. It's a file which data is temporarily stored to when writing. If the temp file isn't automatically deleted, it means an error occurred so it is very likely to contain partial data which cannot be loaded from.

Note that Easy Save will never try to load from the temp file. How are you ascertaining that your original save data is being ignored?

Unfortunately the only way to know what is happening is to check the error logs to see what error is occurring. If you're not sure when this is happening, the best idea is to put your save/load code into a try/catch block and get it to alert you when an exception is thrown.

If you're able to create a case which replicates this, PM it my way and I'll be happy to take a look at it.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
kprime
Posts: 5
Joined: Sat Jun 01, 2019 2:50 am

Re: Save writes a temp file and ignores saves from there

Post by kprime »

Ok this is the error message I get now. So there seems to be a problem at:

ES3Types.ES3Type_GameObject.WriteObject (System.Object obj, ES3Writer writer, ES3+ReferenceMode mode) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:51)

So I'm trying to save a list of gameobjects and there is a problem at line 51 which is about saving the gameobject's components. I thought it was because the gameobjects included component types that they don't support so I tried adding them in the Type tab in the Easy Save window, but that didn't work. Is it maybe that I can't save a gameobject list? Do I have to save them individually?

Thanks
kprime
Posts: 5
Joined: Sat Jun 01, 2019 2:50 am

Re: Save writes a temp file and ignores saves from there

Post by kprime »

Ok finally, I've found the solution. It was the corrupt prefab/meta data problem on the object i'm saving. I tried replacing all the objects i'm saving with a new prefab and reapplied all the necessary components and everything works now. Ugh.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save writes a temp file and ignores saves from there

Post by Joel »

Glad you managed to find the solution!

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply