Custom Editor and displaying Scriptable Objects

I am using some scriptable objects and in one I have a custom inspector, now in that I want a reference to another scriptable object.

I can’t draw the default inspector because I am drawing out the lists in a certain way but I have no idea what field to use to expose the scriptable object reference.

The closest I have come to a solution is using the object field, but then I’m not sure that I can cast an object as a scriptable object.

Any pointers appreciated, I looked through several forums and answers and couldn’t find an answer to this.

Hello.

You were on the right track. You are looking for ObjectField…

p.objectReferenceValue = UnityEditor.EditorGUI.ObjectField(rect, "Any Object", p.objectReferenceValue, typeof(ScriptableObject), false);

Almost all types from UnityEngine inherit from Object. ScriptableObject is one of them. Therefore you can cast it to Object.