How can I draw the default widget for a field in a CustomEditor?

Hi all

I’m writing a CustomEditor script for a class that looks something like:

public class MyClass : MonoBehaviour
    public List<SerializableObject> classContents;

In my CustomEditor I want to loop over the contents of the list and draw the default widget for each item.

I know that I can write custom PropertyDrawers for my SerializableObject, but since I am already taking over the OnInspectorGUI event these drawers will not be created.

Is this possible?


Just call DrawDefaultInspector() whenever you want from within your custom editor, either before or after or intermixed with your custom code.

Since writing this question I’ve learned how and why to use SerializedPropertys. Simply drawing a PropertyField for each list element is sufficient.