I’ve made a custom editor that generates data and stores it into a ScriptableObject asset that is then saved in the project folder. The information saved looks like:
[SerializeField] GameObject obj;
[SerializeField] List<NestedList> list;
I have successfully saved these items into a ScriptableObject. This can be seen using a custom editor that simply exposes the contents of obj
and list
. I can see the Instance ID of obj
, which shows that it has been stored in the asset.
I need to retrieve the data from this ScriptableObject. I have attempted using something similar to:
MyScriptableObject reference = (MyScriptableObject)Selection.activeObject;
This does not get a reference to the ScriptableObject so I can access the obj
and list
fields that have been stored.
1.) Is there a way to do this? SerializedObjects?
2.) Is ScriptableObject even the way to go? The only benefit I see right now vs my own asset file type is the ability to have a custom editor for it.
Thank you.