Multiple custom editors for same type (or should I re-implement as UI?)
I have read similar questions to this one in the forums, but those have not yet been answered, so I thought I would ask here.
I use Unity to send control data to Max/MSP software, to make generative/algorithmic music. I have a MonoBehavior MusicControl
. This script contains my most important public variables for the rest of the system to reference. I have a CustomEditor for MusicControl, MC_MainEditor
. At run-time, via this custom editor, I click on buttons and sliders as needed to change MusicControl values in a performative way. But! There are many different pieces of music or musical "scenes" I perform using this system, so I wanted to have a separate custom editor for each piece of music, changing MusicControl's Inspector. Thus, I was imagining that in MusicControl there could be a public enum whichPiece
that changes between multiple custom editors, each having the attribute [CustomEditor(typeof(MusicControl))]
I have read a related answer that I think suggests it is possible, but then there should only be one inheriting from UnityEditor.Editor, again MC_MainEditor
, and the others should inherit from MC_MainEditor. I tried this, but still only MC_MainEditor will render.
In summary: I do not yet see how I can have multiple custom editors for the same MonoBehavior type, switching between these as needed based on a public enum value. If this is not possible, would the suggestion be to implement this another way, as in a dynamic custom UI?