Custom Editors - Array of Custom Classes

Hey All,

I’ve been unable to find a proper answer to this (apologies if there is one and I’m just blind).

I’m trying to make a custom inspector for a scriptableobject. The scriptable object has a list of type HelpTab. Help tab has two strings inside of it (code example below).

public class HelpTabsScriptableObject : ScriptableObject
{
    [Serializable]
    public class HelpTab
    {
        [SerializeField]
        private string _title;
        public string Title { get { return _title; } }

        [SerializeField]
        private string _description;
        public string Description { get { return _description; } }
    }
    [SerializeField]
    private List<HelpTab> _helpTabs = new List<HelpTab>();
    public List<HelpTab> Tabs { get { return _helpTabs; } }
}

The issue is trying to access _title and _description from _helpTabs. The GetArrayElementAtIndex function doesn’t help much, because this returns a SerializedProperty, and to be able to get the _title and _description we need access to a SerializedObject.

This is as far as I’ve been able to get. Does anyone have any solution or something to look at?

I found out by talking to one of my buddies. The method I was looking for was FindPropertyRelative.

For example:
_helpTabs.GetArrayElementAtIndex(0).FindPropertyRelative("_title").stringValue

@nathanlink169

The property SeriealizedProperty.serializedObject gives you the object you need