Getting ES3 Auto Save to work

Discussion and help for Easy Save 3
yimingt
Posts: 20
Joined: Fri Apr 30, 2021 3:07 am

Getting ES3 Auto Save to work

Post by yimingt »

What I've learnt so far:
1. Only add EasySave components via the EasySave window or in the case of ES3Prefab via right clicking on the prefab and selecting "Enable EasySave for Prefab"
2. Instanced materials will not be saved and would result in a missing material when loading. Solutions depending on cases:
Case 1 (Affecting material that is used by 1 object only): Make sure you adjust the sharedmaterial of the mesh renderer.
Case 2 (Affecting material that is used by many objects): Save the Material directly using an ES3.Save call so that it's saved by value (assuming that the Material is serializable). If it's not serializable, you would need to save the aspects of the colour which change (e.g. the colour), and then load this colour and reassign it to the Material.


I've just started learning how to use Easy Save by following this guide and then playing around with the things in the scene. I understand that prefabs need to have an ES3 Prefab and an ES3 Auto Save component on them and the scene needs to have the Easy Save 3 Manager in it. I'm trying to setup a scene by myself to better understand how the auto saving works but I'm running into this error now.

Code: Select all

FormatException: Expected ',' separating properties or '"' before property name, found '{'.
ES3Internal.ES3JSONReader.ReadPropertyName () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3JSONReader.cs:63)
ES3Reader.ReadRefProperty () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:153)
ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:102)
ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:54)
ES3Reader.ReadObject[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:249)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:278)
ES3Types.ES3CollectionType.ReadICollection[T] (ES3Reader reader, System.Collections.Generic.ICollection`1[T] collection, ES3Types.ES3Type elementType) (at Assets/Plugins/Easy Save 3/Scripts/Types/Collection Types/ES3CollectionType.cs:52)
ES3Types.ES3ArrayType.Read (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Collection Types/ES3ArrayType.cs:36)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:274)
ES3.Deserialize (ES3Types.ES3Type type, System.Byte[] bytes, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:775)
ES3.Deserialize[T] (System.Byte[] bytes, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:764)
ES3File.Load[T] (System.String key, T defaultValue) (at Assets/Plugins/Easy Save 3/Scripts/ES3File.cs:243)
ES3.Load[T] (System.String key, T defaultValue, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:413)
ES3AutoSaveMgr.Load () (at Assets/Plugins/Easy Save 3/Scripts/Auto Save/ES3AutoSaveMgr.cs:81)
ES3AutoSaveMgr.Awake () (at Assets/Plugins/Easy Save 3/Scripts/Auto Save/ES3AutoSaveMgr.cs:100)
I have tried to clear the persistent data path at Tools>Easy Save 3 but the error still occurs after it has made the save file.

I'll also like to keep this thread open to other questions/problems I run into, is that okay?
Last edited by yimingt on Mon Aug 09, 2021 3:36 am, edited 3 times in total.

yimingt
Posts: 20
Joined: Fri Apr 30, 2021 3:07 am

Re: Getting ES3 Auto Save to work

Post by yimingt »

Oh forgot to mention. What I'm trying to do in the new scene is to see how auto saving works with prefabs that are not instantiated but are already in the scene from the start.

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

Re: Getting ES3 Auto Save to work

Post by Joel »

Hi there,
yimingt wrote:
Fri Apr 30, 2021 3:39 am
I'll also like to keep this thread open to other questions/problems I run into, is that okay?
Absolutely, that's fine.

I've not seen this error before. Please could you replicate this in a new project with a simple scene and private message it to me with instructions?

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

yimingt
Posts: 20
Joined: Fri Apr 30, 2021 3:07 am

Re: Getting ES3 Auto Save to work

Post by yimingt »

Hey Joel,

Sorry for the late reply. I have tried replicating my steps in a new project and found no problems at all :shock: . However, the problem still persists on my other project. I noticed that the EasySave I have on the other project is slightly outdated so maybe that might be causing the problem. How do I update the plugin? I don't see an update button in the EasySave window.

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

Re: Getting ES3 Auto Save to work

Post by Joel »

Hi there,

You update Unity assets through Window > Package Manager (or Window > Asset Store on earlier versions of Unity).

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

yimingt
Posts: 20
Joined: Fri Apr 30, 2021 3:07 am

Re: Getting ES3 Auto Save to work

Post by yimingt »

Hey Joel!

Updating the package has solved the problem. :D I'm sorry for the scare, I should have done that first but I was having difficulty finding out how to update the package. Looks like only the owner of the package could update it.

yimingt
Posts: 20
Joined: Fri Apr 30, 2021 3:07 am

Re: Getting ES3 Auto Save to work

Post by yimingt »

Now I'm trying to implement save slots with the Auto Save. I most likely need to set the save path of the auto save using this piece of code:

Code: Select all

ES3AutoSaveMgr.Current.settings.path = "MyFile.es3";
and then manually calling a load.

What I noticed about the ES3AutoSaveMgr is that it's a singleton and it's not set to don't destroy on load. The settings of the Manager are also unique to each Manager. I tried this by having a Manager in the Main Menu and in the game scene. Both had different save events, load events and file path.

Now what I'm thinking for the setup is to have a script that holds the string of the file to load, travel between scenes to tell the Manager in the game scene whether to load a save and what file to load. Would that be the best approach?

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

Re: Getting ES3 Auto Save to work

Post by Joel »

Hi there,

This is intended because an Auto Save relates to objects in a scene which would not be referenceable if the object was marked as DontDestroyOnLoad.

In this case you would generally put your save slot into a static variable, and then assign this to the Auto Save Component whenever you enter a scene.

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

yimingt
Posts: 20
Joined: Fri Apr 30, 2021 3:07 am

Re: Getting ES3 Auto Save to work

Post by yimingt »

Hey Joel,

When setting the component to save for Prefabs, should I be referencing every component or is the system able to instantiate the prefab's components and children based on the original prefab?

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

Re: Getting ES3 Auto Save to work

Post by Joel »

Hi there,

You only need to select Components which you want variables saved on. All Components attached to the prefab will be created when the prefab is instantiated.

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

Post Reply