I've been butting my head against a wall for the past couple of days trying to come up with a good solution for this issue.
I'm working on designing a system that will allow me to create my own in-engine cutscenes for a 2D game. I have a bunch of classes representing different events that can take place during a cutscene e.g. moving an object, changing a sprite. These events have different fields (moving a game object requires a game object to move, a speed, and a time. Changing a sprite requires a sprite renderer and sprite). I need to be able to display a list in the inspector that will let me add a new event of any available type so that the fields can be set. And then in the backend, a manager class will take this list and execute all of the event actions.
The system I designed uses an interface with an ExecuteEvent() function that the concrete event classes (such as EventMoveGameObject) implement, along with whatever fields they specifically require. Since Unity can't display interfaces in the inspector panel (and even if it could, it wouldn't be able to display the fields of the concrete class implementing the interface), I made a class called EventContainer which contains an enum with options for each event type and an EventContainer class which stored the event type enum of an event and the interface.
I thought maybe I could downcast the interface to its concrete class in a custom editor script, render the concrete fields in the inspector panel, and that way I'd be able to edit the fields while still keeping all of these different event classes in one list. This failed miserably hehehe. There's a bunch of issues with this implementation that mean it just won't work. It's obvious now but I didn't realise at the time that I couldn't cast the serialized interface back into a class.
This is a long-winded way of asking, what would be a better way to organise this data? Events that require different variables and execute different actions all displayed together in the inspector panel, ready to edit fields and create new instances.
Relevant classes and functions should all be here but feel free to ask for any additional code: https://paste.ofcode.org/ZrVbx2ivhFbt7GmCYshPza