How Can I Display UnityEvent in Custom Inspector When it is a Property of a Properties Property? (C#)

So I have a custom inspector for a Monobehavior, this Monobehavior has a property that is a ScriptableObject class, the ScriptableObject class has a property that is a List of a custom Type, this custom Type has a property of a list of another custom Type, that Type has a UnityEvent property.

I want the UnityEvent to show up in the CustomInspector, I can access the ScriptableObject classes property, but am not sure how to access the properties of the list it contains.

(To my knowledge UnityEvents can only be displayed by EditorGUILayout.PropertyField, with the UnityEvent being the serialized property.)

So what I have now is something like this:

OnInspectorGUI()
{

MyBaseClass base = (MyBaseClass)target;

SerializedObject serializedObject = new SerializedObject(base.myScriptableObjectProperty);

SerializedProperty myCustomListProperty1 = serializedObject.FindProperty("customPropertyName");

//Access myCustomListProperty1's List
//Get myCustomListProperty2
//Get the UnityEvent property from that list

EditorGUILayout.PropertyField(myUnityEventProperty);

}

I’m new to using properties like this, any help is appreciated :slight_smile:

If you just want to draw everything, you can of course do EditorGUILayout.PropertyField(myCustomListProperty, true);

If you need to find a specific child property, use SerializedProperty.FindRelative(). If you need to get an element for a list property, use SerializedProperty.GetArrayElementAtIndex().