Can you save ScriptableObjects by asset reference, without instantiating them? I haven't had any issue saving/loading Instantiated SOs, but any time I save a class with a reference to an SO asset, it always nulls out on reload.
Is what I'm attempting even possible?
Thanks in advance
Saving ScriptableObjects by asset reference
Re: Saving ScriptableObjects by asset reference
Hi there,
This is indeed possible, but you will need to make sure that your scene references that SO (i.e. there's a variable in your scene which contains a reference to that SO at build time), otherwise it won't be added to the reference manager.
You might also want to press the Refresh References button on the ES3ReferenceMgr Component of the Easy Save 3 Manager after doing this to ensure that it's detected.
A basic test script which demonstrates this is as follows:
Joel
This is indeed possible, but you will need to make sure that your scene references that SO (i.e. there's a variable in your scene which contains a reference to that SO at build time), otherwise it won't be added to the reference manager.
You might also want to press the Refresh References button on the ES3ReferenceMgr Component of the Easy Save 3 Manager after doing this to ensure that it's detected.
A basic test script which demonstrates this is as follows:
using UnityEngine; public class ScriptWithSO : MonoBehaviour { public ScriptableObject so; // Start is called before the first frame update void Start() { ES3.Save<ScriptWithSO>("so", this); so = null; ES3.LoadInto<ScriptWithSO>("so", this); } }All the best,
Joel
Re: Saving ScriptableObjects by asset reference
Gotcha, so either way it needs to already exist in the scene via an SO "database" component that already exists.
Thanks for your quick response!
Thanks for your quick response!