Saving Scriptable Object Data - Inconsistent Between Builds

Discussion and help for Easy Save 3
Post Reply
gumbomasta
Posts: 10
Joined: Thu Jun 01, 2017 4:24 pm

Saving Scriptable Object Data - Inconsistent Between Builds

Post by gumbomasta »

Hi,

I've set up several of my Scriptable Objects so that I can reference them as-is to be read by ES3.Load<SOInventoryItem>.

this is what saved data looks like in a JSON file:

For example,

"Picture_Of_Saxophone": {
"__type": "SOInventoryItem,Assembly-CSharp",
"value": {
"_ES3Ref": 6028262174322791446,
"itemState": 11,
"price": 0
}

This reference should save the SO's data and reference it for future loading using it's _ES3Ref #.

The problem is, the ES3Ref number changes, usually when I'm making new builds, or changing something around in my scene architecture, or working with multiple scenes.

Is there a way to keep the ES3ref consistent? Or a recommended practice to avoid having it change?

Or should I avoid using ES3Refs at all for my saving and loading of data (since I have the objects loaded in their own database - I don't actually need to load the data itself) and instead just use something like a string match.

guidance appreciated!

-G
gumbomasta
Posts: 10
Joined: Thu Jun 01, 2017 4:24 pm

Re: Saving Scriptable Object Data - Inconsistent Between Bui

Post by gumbomasta »

Also, I'm seeing multiple references to the same item in the ES3 Reference manager: Image

Many of these items are scriptable objects and are referenced in many places.

Is this normal? Is there something I should be doing about this? Is this the cause of my issues?

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

Re: Saving Scriptable Object Data - Inconsistent Between Bui

Post by Joel »

Hi there,

I've had no reports of references spontaneously losing their ID or duplicate IDs. Is it possible to PM me a basic project which replicates this?

The reference ID can be lost if the GameObject is deleted, and Unity generates new reference IDs (this is true of Unity also, not just Easy Save), or if the reference manager is in a different scene to the references which were used to create it.

Note that if you're not using the latest version of Easy Save, I recommend updating as we've change the implementation in newer versions to address a bug. If you're able to (i.e. if you're not dependent on existing save data), it might also be worth deleting your reference mangers after doing this so that they're automatically recreated.

Let me know how you get on.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
gumbomasta
Posts: 10
Joined: Thu Jun 01, 2017 4:24 pm

Re: Saving Scriptable Object Data - Inconsistent Between Bui

Post by gumbomasta »

Thanks for the response.

I hadn't upated ES since you posted, so I'll do that and keep you posted about the issue at hand.
Post Reply