View and Edit Properties of List items in inspector

I have a class called Menu. Menu has a List of MenuItems, each of which simply has two string variables: title and content.

I want to be able to define MenuItems right in the inspector while viewing an instance of Menu.

Right now I see this:

45363-capture.png

How can I make it so that I can expand each MenuItem in the list so that I can see its properties in the inspector, effectively creating new instances with the properties that I specify at runtime?

I’m thinking that I need to extend the editor to do this, but I am unfamiliar with editor scripting.

How would I go about implementing something like this?

The screenshot looks a bit weird. Usually only classes that represent a serializable reference are viewed like this. So i guess you have derived your MenuItem class from ScriptableObject or MonoBehaviour. Either way both aren’t suitable in this case.

You should simply declare it as an ordinary class without base class and put the Serializable attribute on it:

// C#
[System.Serializable]
public class MenuItem
{
    // Your content
}

edit
Note: This way Unity doesn’t support inheritance for the MenuItem class. In other words if you derive another class from MenuItem, technically you could store an instance in that array / List, but that’s not supported by Unity. Unity serializes such classes based on the element type of the collection (array / List). So every item in the array / List has to be a MenuItem instance.