Page 1 of 1

Editor crashes when adding Easy Save Manager after custom Type

Posted: Fri Feb 10, 2023 7:23 pm
by gblekkenhorst
Everything was working great until I needed to add a custom type to the system. We have a class called Song which just holds a bunch of variables, and I need to save a List<Song> into the system as the player collects new songs.

I added the new type using Window / Easy Save 3 / Types/ Create ES3 Type Script.

We're saving using this code:

Code: Select all

        if (ES3.KeyExists(key + "_songList", SaveController.filename))
        {
            SongList = ES3.Load<List<Song>>(key + "_songList", SaveController.filename);
        }
Now I get this error when I try to save:
InvalidOperationException: An Easy Save 3 Manager is required to save references. To add one to your scene, exit playmode and go to Assets > Easy Save 3 > Add Manager to Scene

I try to add a Manager to the scene, but it crashes Unity (And Chrome and Discord for some reason) every time. Our scene is quite large. Adding the manager to an empty scene works fine, so I assume it's the scene size that's crashing it.

We are using Dialogue System with Easy Save bridge. Unity 2020.2.6f. We're not using autosave, just multiple save slot/files from a menu.

Re: Editor crashes when adding Easy Save Manager after custom Type

Posted: Fri Feb 10, 2023 8:39 pm
by gblekkenhorst
Oh, turning off everything in the scene let me add the manager. It's not saving properly yet but the crashing issue is fixed.

Re: Editor crashes when adding Easy Save Manager after custom Type

Posted: Fri Feb 10, 2023 11:15 pm
by gblekkenhorst
gblekkenhorst wrote: Fri Feb 10, 2023 8:39 pm Oh, turning off everything in the scene let me add the manager. It's not saving properly yet but the crashing issue is fixed.
This is the error I'm getting now:

Code: Select all

FormatException: Input string was not in a correct format.
System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Int32.Parse (System.String s) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
ES3Internal.ES3JSONReader.Read_int () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3JSONReader.cs:549)
ES3Types.ES3Type_enum.Read[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Primitive Types/ES3Type_enum.cs:42)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:272)
ES3Reader.Read[T] () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:126)
ES3Types.ES3UserType_Song.ReadObject[T] (ES3Reader reader, System.Object obj) (at Assets/Easy Save 3/Types/ES3UserType_Song.cs:42)
ES3Types.ES3UserType_Song.ReadObject[T] (ES3Reader reader) (at Assets/Easy Save 3/Types/ES3UserType_Song.cs:63)
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.ES3ListType.Read (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Collection Types/ES3ListType.cs:64)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:274)
ES3Reader.Read[T] (System.String key) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:197)
ES3.Load[T] (System.String key, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:391)
ES3.Load[T] (System.String key, System.String filePath) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:365)
MusicManager.LoadGameEnd () (at Assets/Scripts/MusicPlayer/MusicManager.cs:356)
SaveController.LoadGame (System.Int32 _slot) (at Assets/SaveController.cs:129)
UnityEngine.Events.InvokableCall`1[T1].Invoke (T1 args0) (at <31d5d65b32ec483292e13e8ae4100b93>:0)
UnityEngine.Events.CachedInvokableCall`1[T].Invoke (System.Object[] args) (at <31d5d65b32ec483292e13e8ae4100b93>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <31d5d65b32ec483292e13e8ae4100b93>:0)
UnityEngine.UI.Button.Press () (at C:/Program Files/UnityEditors/2020.2.6f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/UnityEditors/2020.2.6f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/UnityEditors/2020.2.6f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/UnityEditors/2020.2.6f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:262)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/UnityEditors/2020.2.6f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:385)
This is the class I'm trying to save:

Code: Select all

    [System.Serializable]
    public class Song
    {
        public string Name;
        public string Artist;
        public MoodTag Tag;
        public AudioClip Clip;
        public Sprite AlbumArt;
        public string FMODPath;
    }

Re: Editor crashes when adding Easy Save Manager after custom Type

Posted: Sat Feb 11, 2023 8:21 am
by Joel
Hi there,

I don't appear to be encountering any issues when saving your class. First I recommend deleting any save data by going to Tools > Easy Save 3 > Clear Persistent Data Path.

If this doesn't resolve the issue 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

Re: Editor crashes when adding Easy Save Manager after custom Type

Posted: Fri Feb 17, 2023 5:31 am
by gblekkenhorst
I tried to recreate in a new project and it worked properly. I didn't even need to use the type manager.

In the original project, I reset the type in the type manager so it is no longer explicit.

Now saving and loading works, but only if I have the Easy Save manager in the scene. In my recreated project did not need the manager? The manager more than doubles the size of the scene which interfers with our source controller as it goes from 92mb to 250mb. What is the manager doing? Is there a way I can make this work without the manager?

Thanks!

Re: Editor crashes when adding Easy Save Manager after custom Type

Posted: Fri Feb 17, 2023 8:32 am
by Joel
Hi there,

The Easy Save 3 Manager is required if you're saving Unity reference types as this contains the reference manager (for example in your class you're trying to save an Audio clip and Sprite).

By default it will add all direct dependencies and Prefabs to your reference manager. However, if you go to Tools > Easy Save 3 > Settings and uncheck Auto Add References to Mgr and Add Prefabs to Mgr, it will no longer automatically add references to the manager.

If you delete the manager and re-add it, it should then be empty. Then you can manually add whichever objects you will want to save or load by reference by right-clicking them and selecting Easy Save 3 > Add References to Manager.

All the best,
Joel

Re: Editor crashes when adding Easy Save Manager after custom Type

Posted: Fri Feb 17, 2023 3:58 pm
by gblekkenhorst
Thank you so much! This worked perfectly!