What is this odd behavior on scriptable objects? They don't save anymore.

Discussion and help for Easy Save 3
Post Reply
AHAKuo
Posts: 16
Joined: Fri Dec 04, 2020 9:46 pm

What is this odd behavior on scriptable objects? They don't save anymore.

Post by AHAKuo »

I have a scriptable object, a couple of them and the issue is that any edits I make to them are randomly not saved, and I'm not sure why. At first, I thought the custom inspector was the problem, but it turns out that's not the case.

Here's a video describing the issue: https://www.youtube.com/watch?v=PJNVE4BkjFc

My unity was 2020.1.6, and this issue never happened. However, when I upgraded to unity 2021.3.1 LTS, I realized that this started happening, and only after many tests, did I find out it was ES3 that was causing this issue.

I'm not sure why this is happening, especially in version 2021.

My unity is 2021.3.1 LTS
My ES3 is 3.4.2.


Any help would be greatly appreciated.
AHAKuo
Posts: 16
Joined: Fri Dec 04, 2020 9:46 pm

Re: What is this odd behavior on scriptable objects? They don't save anymore.

Post by AHAKuo »

Keep in mind, I am not saving or loading this scriptable object. I never do. However, the scriptable object does contain ES3 functions as booleans. But they don't directly load or save the scriptable object.

In this case, I don't understand why the scriptable object is affected at all by the es3 manager.

And if it is being affected, I don't understand why it won't save my edits or be consistent with them. This happens randomly and there are no clear repro steps to make it happen. The project I'm in is too far into development, and any problems will be difficult to repro properly.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: What is this odd behavior on scriptable objects? They don't save anymore.

Post by Joel »

Hi there, and thanks for getting in contact.

We've had no reports of behaviour like this before, but it looks to me that a Component is marked to be saved in the Tools > Easy Save 3 > Auto Save window which references this ScriptableObject. Deleting the Easy Save 3 Manager stops this because it's deleting the ES3AutoSaveMgr Component.

Please could you specifically delete the ES3AutoSaveMgr Component on the Easy Save 3 Manager (nothing else) and see if it still happens.

Note that the ES3AutoSaveMgr Component does nothing if nothing is selected in the Auto Save window, so if you're not using Auto Save you might also want to check that nothing is selected there. If you are using Auto Save, you should double-check whether there is anything selected which references your ScriptableObject.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
AHAKuo
Posts: 16
Joined: Fri Dec 04, 2020 9:46 pm

Re: What is this odd behavior on scriptable objects? They don't save anymore.

Post by AHAKuo »

Joel wrote: Wed May 11, 2022 9:09 am Hi there, and thanks for getting in contact.

We've had no reports of behaviour like this before, but it looks to me that a Component is marked to be saved in the Tools > Easy Save 3 > Auto Save window which references this ScriptableObject. Deleting the Easy Save 3 Manager stops this because it's deleting the ES3AutoSaveMgr Component.

Please could you specifically delete the ES3AutoSaveMgr Component on the Easy Save 3 Manager (nothing else) and see if it still happens.

Note that the ES3AutoSaveMgr Component does nothing if nothing is selected in the Auto Save window, so if you're not using Auto Save you might also want to check that nothing is selected there. If you are using Auto Save, you should double-check whether there is anything selected which references your ScriptableObject.

All the best,
Joel
Hi, Joel. I did try doing that before, but the issue still happened. I also tried making a new ES3 manager by deleting and adding a new one. The issue still persisted. I don't even use autosave, unless it's activated by default (I don't know about that)

I could try more, maybe delete and install es3 again, but I'm not sure if that would help. I'm away from the pc for a few days so I can't immediately test anything at this time.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: What is this odd behavior on scriptable objects? They don't save anymore.

Post by Joel »

Hi there,

If you're able to create a cut-down version of your project which you can share with me I'm happy to debug it. Unfortunately without this it wouldn't be possible for me to understand what is happening as we've had no other reports of this.

All the other Component attached to the Easy Save 3 Manager does is hold a Dictionary of references: it doesn't do anything with these apart from allow you to look up a particular reference with a particular reference ID. So the idea that this is causing the behaviour you describe is very unusual.

Just to check, every time you delete the Easy Save 3 Manager it resolves the issue permanently? You mention that the issue was intermittent, so just checking that you've factored this in.

Another thing you might want to try is to turn the variables in question into a property and get it to Debug.Log whenever it is set. I.e.

Code: Select all

private bool _myBool;
public bool myBool
{
	set
	{
		Debug.Log("myBool set from" + _myBool + " to " + value );
		_myBool = value;
	}
	get
	{
		return _myBool;
	}
}
The output of this call will show you the complete stack trace whenever it is modified, and thus where any changes to that variable are coming from.

Another thing to check is whether you're getting any errors or warnings from Easy Save. I noticed in the video you permanently have a NullReferenceException in the console. This means I can't see whether any exceptions are being thrown by Easy Save, but any exceptions can affect the execution of other code within your project, so it's worth checking that all Exceptions are handled correctly, regardless of whether they relate to Easy Save.

In the meantime please let me know if you get any other info which might help us understand what is happening.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
AHAKuo
Posts: 16
Joined: Fri Dec 04, 2020 9:46 pm

Re: What is this odd behavior on scriptable objects? They don't save anymore.

Post by AHAKuo »

Joel wrote: Wed May 11, 2022 4:19 pm Hi there,

If you're able to create a cut-down version of your project which you can share with me I'm happy to debug it. Unfortunately without this it wouldn't be possible for me to understand what is happening as we've had no other reports of this.

All the other Component attached to the Easy Save 3 Manager does is hold a Dictionary of references: it doesn't do anything with these apart from allow you to look up a particular reference with a particular reference ID. So the idea that this is causing the behaviour you describe is very unusual.

Just to check, every time you delete the Easy Save 3 Manager it resolves the issue permanently? You mention that the issue was intermittent, so just checking that you've factored this in.

Another thing you might want to try is to turn the variables in question into a property and get it to Debug.Log whenever it is set. I.e.

Code: Select all

private bool _myBool;
public bool myBool
{
	set
	{
		Debug.Log("myBool set from" + _myBool + " to " + value );
		_myBool = value;
	}
	get
	{
		return _myBool;
	}
}
The output of this call will show you the complete stack trace whenever it is modified, and thus where any changes to that variable are coming from.

Another thing to check is whether you're getting any errors or warnings from Easy Save. I noticed in the video you permanently have a NullReferenceException in the console. This means I can't see whether any exceptions are being thrown by Easy Save, but any exceptions can affect the execution of other code within your project, so it's worth checking that all Exceptions are handled correctly, regardless of whether they relate to Easy Save.

In the meantime please let me know if you get any other info which might help us understand what is happening.

All the best,
Joel
Thank you, Joel!

The console actually has two exceptions that have been there since Unity 2020. They relate to an editor tool I use but they never caused this kind of problem. Easy save does not throw errors at all.

Also, yes, when I remove the manager, the problem goes away completely, but the moment I bring it back in, the value is back to 5 just like in the video. Almost as if the value is saved as 5 and loading to 5. Which es3 should not be doing at all since I don't want to save these values.

I can make a cut down version of the project and send it your way, but I can't do that at the moment as I'm away from the pc for a few days. When I make it, I'll send it to you.

I will also try this debug trick you provided and see if I can catch the script that is changing the value and what line specifically.

Thank you for your help!
AHAKuo
Posts: 16
Joined: Fri Dec 04, 2020 9:46 pm

Re: What is this odd behavior on scriptable objects? They don't save anymore.

Post by AHAKuo »

Joel wrote: Wed May 11, 2022 4:19 pm Hi there,

If you're able to create a cut-down version of your project which you can share with me I'm happy to debug it. Unfortunately without this it wouldn't be possible for me to understand what is happening as we've had no other reports of this.

All the other Component attached to the Easy Save 3 Manager does is hold a Dictionary of references: it doesn't do anything with these apart from allow you to look up a particular reference with a particular reference ID. So the idea that this is causing the behaviour you describe is very unusual.

Just to check, every time you delete the Easy Save 3 Manager it resolves the issue permanently? You mention that the issue was intermittent, so just checking that you've factored this in.

Another thing you might want to try is to turn the variables in question into a property and get it to Debug.Log whenever it is set. I.e.

Code: Select all

private bool _myBool;
public bool myBool
{
	set
	{
		Debug.Log("myBool set from" + _myBool + " to " + value );
		_myBool = value;
	}
	get
	{
		return _myBool;
	}
}
The output of this call will show you the complete stack trace whenever it is modified, and thus where any changes to that variable are coming from.

Another thing to check is whether you're getting any errors or warnings from Easy Save. I noticed in the video you permanently have a NullReferenceException in the console. This means I can't see whether any exceptions are being thrown by Easy Save, but any exceptions can affect the execution of other code within your project, so it's worth checking that all Exceptions are handled correctly, regardless of whether they relate to Easy Save.

In the meantime please let me know if you get any other info which might help us understand what is happening.

All the best,
Joel
Hello, Joel.

I just got back from my hiatus, and I just tried the debugging method. It did not work for me. More importantly, I found even stranger behaviour.

Before, I said that the scriptable object field was not saving or was being reset to its initial value before editing. It turns out that this is happening for all variables, not just one. And the issue does not seem to go away at all.

However, I tried this:

I went into the easy save settings > Editor > And disabled all three check marks over there. I disabled "Auto Update References", "Global References" and any other settings with them. This fixed the issue. But now ES3 does not work in other parts of the game. Lots of saving and loading options have broken up. Obviously, this means I need the manager and keep those check marks enabled in order to use ES3 properly, but the manager is the sole reason for this problem and I just don't understand why. The debugging method didn't work for me, so right now I'm just stuck with no clues.

If you can share with me an email or a place where I can send a cut-down version of the project, that would be nice! You can inspect the issue yourself and see what exactly is going on. As it may be time for a new bug fix in the asset. Although, with how big the project is, I might just send the entire project since cutting it down is not so simple.

At the moment, it seems my best course of action is to just not save references like scriptable objects anymore and just stick to saving plain strings and booleans instead. This is the best I can do right now, but you should still look into the issue and see if it's something that warrants a bug fix on your part.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: What is this odd behavior on scriptable objects? They don't save anymore.

Post by Joel »

Hi there,

You can send a link to a cut down version of the project via moodkie.com/contact. We unfortunately wouldn’t be able to look at a complete project because we would need to understand your entire project before being able to debug the issue.

Note that Easy Save relies on the manager if you’re saving references.

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