Hello,
I just found loading a SO also loads the data inside the SO. I am using SOs as info sources and don't want their data to be saved in runtime. How can I save the ref only?
How to store the ref of a ScriptableObject only?
-
- Posts: 13
- Joined: Sun Oct 01, 2023 11:04 am
Re: How to store the ref of a ScriptableObject only?
Hi there,
The Choosing what is saved guide describes how to choose which fields are saved:
https://docs.moodkie.com/easy-save-3/es ... -is-saved/
In your case you would mark all of the fields as ES3NonSerializable or deselect all of the fields in the Types window.
All the best,
Joel
The Choosing what is saved guide describes how to choose which fields are saved:
https://docs.moodkie.com/easy-save-3/es ... -is-saved/
In your case you would mark all of the fields as ES3NonSerializable or deselect all of the fields in the Types window.
All the best,
Joel
-
- Posts: 13
- Joined: Sun Oct 01, 2023 11:04 am
Re: How to store the ref of a ScriptableObject only?
After some research, I found it was because I was storing them to a List<object> so they were not saved by ref. After changing it to List<UnityEngine.Object> they are now being saved by ref.
Is there another way to explicitly save an object by ref?
Is there another way to explicitly save an object by ref?
Re: How to store the ref of a ScriptableObject only?
The only other way would be to get the reference ID and save and load that (though note that this is intentionally undocumented). You can get a reference ID using:
long id = ES3ReferenceMgr.Current.Get(object);
And get a reference from a reference ID using:
UnityEngine.Object obj - ES3ReferenceMgr.Current.Get(id);
All the best,
Joel
long id = ES3ReferenceMgr.Current.Get(object);
And get a reference from a reference ID using:
UnityEngine.Object obj - ES3ReferenceMgr.Current.Get(id);
All the best,
Joel