Quick Save troubles with build.

Discussion and help for Easy Save 3
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

Here's a NullReferenceException error log. It happens upon quick load, and it often seems to be referencing the object that is calling the load.

NullReferenceException: Object reference not set to an instance of an object
ES3Types.ES3Type_Fsm.ReadObject[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/PlayMaker/ES3PlayMaker.cs:1808)
ES3Types.ES3Type_Fsm.ReadObject[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/PlayMaker/ES3PlayMaker.cs:1829)
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.ES3UserType_PlayMakerFSM.ReadComponent[T] (ES3Reader reader, System.Object obj) (at Assets/Easy Save 3/Types/ES3UserType_PlayMakerFSM.cs:38)
ES3Types.ES3ComponentType.ReadUnityObject[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ComponentType.cs:36)
ES3Types.ES3UnityObjectType.ReadObject[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3UnityObjectType.cs:65)
ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:77)
ES3Types.ES3Type_GameObject.ReadComponents (ES3Reader reader, UnityEngine.GameObject go) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:216)
ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:167)
ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:77)
ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:131)
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)
ES3Reader.Read[T] (System.String key, T defaultValue) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:212)
ES3.Load[T] (System.String key, T defaultValue, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:439)
ES3AutoSaveMgr.Load () (at Assets/Plugins/Easy Save 3/Scripts/Auto Save/ES3AutoSaveMgr.cs:85)
ES3PlayMaker.ES3AutoSaveLoad.OnEnter () (at Assets/Plugins/Easy Save 3/PlayMaker/ES3PlayMaker.cs:1597)
HutongGames.PlayMaker.FsmState.ActivateActions (System.Int32 startIndex) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:222)
HutongGames.PlayMaker.FsmState.OnEnter () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:192)
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3073)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3012)
HutongGames.PlayMaker.Fsm.UpdateStateChanges () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2945)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3089)
HutongGames.PlayMaker.Fsm.Update () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2232)
PlayMakerFSM.Update () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:624)
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Quick Save troubles with build.

Post by Joel »

Hi there,

Unfortunately this doesn’t provide much information. Could you replicate this error in a new project with a simple scene and private message it to me with step by step instructions so I can debug it at my end.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

NullReferenceException: Object reference not set to an instance of an object
at ES3Types.ES3Type_Fsm.ReadObject[T] (ES3Reader reader, System.Object obj) [0x0000f] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\PlayMaker\ES3PlayMaker.cs:1808
at ES3Types.ES3Type_Fsm.ReadObject[T] (ES3Reader reader) [0x00006] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\PlayMaker\ES3PlayMaker.cs:1829
at ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) [0x00034] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:54
at ES3Reader.ReadObject[T] (ES3Types.ES3Type type) [0x00012] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:249
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x00076] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:278
at ES3Types.ES3UserType_PlayMakerFSM.ReadComponent[T] (ES3Reader reader, System.Object obj) [0x0007f] in C:\Users\agaug\Hyperliminal\Assets\Easy Save 3\Types\ES3UserType_PlayMakerFSM.cs:38
at ES3Types.ES3ComponentType.ReadUnityObject[T] (ES3Reader reader, System.Object obj) [0x00000] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ComponentType.cs:36
at ES3Types.ES3UnityObjectType.ReadObject[T] (ES3Reader reader, System.Object obj) [0x0006f] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\ES3UnityObjectType.cs:65
at ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) [0x00034] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:77
at ES3Types.ES3Type_GameObject.ReadComponents (ES3Reader reader, UnityEngine.GameObject go) [0x000d7] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:216
at ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader, System.Object obj) [0x001e8] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:167
at ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) [0x00034] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:77
at ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader) [0x00111] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:131
at ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) [0x00034] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:54
at ES3Reader.ReadObject[T] (ES3Types.ES3Type type) [0x00012] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:249
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x00076] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:278
at ES3Types.ES3CollectionType.ReadICollection[T] (ES3Reader reader, System.Collections.Generic.ICollection`1[T] collection, ES3Types.ES3Type elementType) [0x00012] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\Collection Types\ES3CollectionType.cs:52
at ES3Types.ES3ArrayType.Read (ES3Reader reader) [0x00006] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Types\Collection Types\ES3ArrayType.cs:36
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x0004a] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:274
at ES3Reader.Read[T] (System.String key, T defaultValue) [0x00012] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:212
at ES3.Load[T] (System.String key, T defaultValue, ES3Settings settings) [0x00025] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\ES3.cs:439
at ES3AutoSaveMgr.Load () [0x0002b] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\Scripts\Auto Save\ES3AutoSaveMgr.cs:85
at ES3PlayMaker.ES3AutoSaveLoad.OnEnter () [0x00000] in C:\Users\agaug\Hyperliminal\Assets\Plugins\Easy Save 3\PlayMaker\ES3PlayMaker.cs:1597
at HutongGames.PlayMaker.FsmState.ActivateActions (System.Int32 startIndex) [0x0004b] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:222
at HutongGames.PlayMaker.FsmState.OnEnter () [0x00064] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:192
at HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state) [0x0008e] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:3073
at HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState) [0x0005b] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:3012
at HutongGames.PlayMaker.Fsm.UpdateStateChanges () [0x00002] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2945
at HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) [0x0000d] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:3089
at HutongGames.PlayMaker.Fsm.Update () [0x0003f] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2232
at PlayMakerFSM.Update () [0x0001a] in C:\Projects\Playmaker_1.9.1\Projects\Playmaker.source.unity\Assets\PlayMaker\PlayMakerFSM.cs:624

(Filename: Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs Line: 167)
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

Oops, I didn't see your reply before sending this. I don't think I can replicate it...I was unable to on a different project. This one is pretty large (well, large to me), so it's something wrong I'm doing elsewhere. Trying to reference something that may have been destroyed? I'm not sure. I'll keep digging and see what I can come up with. Thanks again for your time.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Quick Save troubles with build.

Post by Joel »

I'd also recommend checking that you're on the latest version of Easy Save just in case there are any issues relating to this which have been resolved since the version you are on.

Also just to check, are you trying to save an Fsm using Auto Save at any point? This could possibly cause this error. If you're trying to save Fsm Variables you should instead use the Save/SaveAll and Load/LoadAll actions to save the FsmVariables from within the Fsm itself.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

Thanks, I'll use those functions to save variables. Yeah, I had the FSM box checked on a few objects (I was attempting to save which state they were in, so they would reset upon reloading), but I can give it a go disabling that. Either way, I'm not quite sure why, but I deleted the Easy Save 3 folders from my assets entirely and reinstalled it and I'm not getting the errors anymore. At this point I don't really know what to make of that, but weird. Anyway thanks again for your time. I left your asset a positive review as good customer support is always appreciated.

I'll update this thread if I come across anything else, so as to hopefully help potential people that are looking in the future with similar issues.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Quick Save troubles with build.

Post by Joel »

Glad you managed to find a solution. It could be that the save file has corrupt data in from previous testing.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

So, I wanted to give a bit of an update in case there are people in the future that might run into similar problems. And thanks again to Joel for having the patience to talk me through it, as I'm not sure I'd have been able to figure it out without talking it through.

Before I start, I want to clarify that I use Playmaker exclusively for calling ES3 actions, so for those of you that may be having trouble due to writing code, this may not help.

Knock on wood, I think everything is working properly now. I've re-tested through everything I've mentioned in previous posts, from saving to loading through menu to dying etc, etc, and it seems like it's now working. Deleting the Easy Save folders (always make a backup and know what to delete, or you're going to have a bad time!) and reinstalling helped with the previous errors I was getting. Not sure why, but it did. Keep in mind, I originally just kinda plugged this bastard in and messed with it without fully knowing what I was doing, so I'm 100% confident any problem I had was user error and not the asset itself.

That being said, here's what I did wrong:

First, the saving. Of course, you need to first configure what is to be saved through the Auto Save settings menu. My game is very linear so I pretty much just need to save the active/inactive states of the bad guys, the triggers, and the location of the player.

As you may have read before, I had a few autosave trigger points. As I said, the game is linear (first person story telling) so the whole idea of having saves in the first place was so that if you died you wouldn't have to start all the way from the beginning, which could be 30 minutes ago. No fun.

The save points are just invisible trigger box colliders with FSMs (Playmaker state machines) on them, whose states essentially went:

>Upon trigger enter > ES3 Auto Save > To a third state, which inactivated them.

I had about 6 of those through the linear game. Now for the loading.

I had a few "bad guys" that would chase you around with separate children trigger-sphere-colliders attached to them that would kill you upon collision. Bad guy catches you, you die, pretty standard. Only about 8 enemies in the game - and well spread out - so not a bunch of guys coming at you at once.

The spherical "kill player" colliders had FSMs like this:

>Trigger collision with player > [All the fancy stuff like screen going black/sound effects/"You Died!", etc] > Wait a few seconds > ES3 Auto Load

Not sure why, but this caused all sorts of problems and seemed to be a fundamentally flawed way to do it. As I look back on it now it seems a bit more obvious that this was silly because I had almost two dozen different save/kill&reload triggers with their own FSMs. Regardless, THIS APPROACH DID NOT WORK.

How I fixed it:

Rather than having a bunch of "kill player" colliders attached to enemies that all have their own "Trigger>DyingEvents>ES3 Auto Load" FSMs, I made a GameObject that solely handles the loading and saving.

I created a single GameObject (I'll call it "SaveLoad") with its own FSM. This single FSM handles everything. The start state is a general "idle/waiting" state, and then it branches off to either "load" or "save" (make sure it transitions back to the idle state when done!), depending on what is called.

So, rather than the "kill player" colliders having their own FSMs with their own ES3 Auto Load calls (which I can't even begin to describe how many problems were caused by this), you Send Event/broadcast the global "save" or "load" event to said SaveLoad object instead.

I can't tell you why exactly because I'm still relatively new to this, but putting the loading and saving into one object to be remotely called rather than many objects that are doing the work on the spot was the make or break difference. Sounds obvious when I say it now after figuring it out, but I definitely learned the hard way.

I hope this made sense. Again, this might be "duh" to a lot of more experienced folks out there, but this advice was exactly what I needed to hear a few weeks ago, so I hope it can help someone out there down the line.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Quick Save troubles with build.

Post by Joel »

Thanks for taking the time to put together a detailed explanation, hopefully this helps other people out in the future. In a lot of cases have a single save/load ‘manager’ becomes the easiest option as there’s only one place to debug.

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