Multiple custom editors for the same type
I'm making a plugin based C# application, where some plugins might sometimes be installed, sometimes not.
In my plugin Plugin1
, I have a component Plugin1.Component1
. In that same project, I implement a custom editor for it, called Plugin1.Component1Editor
, that is a [CustomEditor(typeof(Plugin1.Component1))]
. When Plugin1
is installed, the Component1
is available, and rendered with the custom editor.
My plugin Plugin2
depends on Plugin1
. Depending on settings in its component Plugin2.Component2
, it would like to alter the custom editor for Plugin1.Component1
.
I have implemented a new custom editor in Plugin2
, called Plugin2.Component1Editor
, that is also a [CustomEditor(typeof(Plugin1.Component1))]
. It inherits from UnityEditor.Editor
, not from Plugin1.Component1Editor
, as the latter caused problems with serialized properties not being found in Plugin1.Component1Editor
.
Plugin2.Component1Editor
won't collide with Plugin1.Component1Editor
at compile time, as it has its own namespace. But what actually happens in the Unity inspector?
The behaviour when I test it is the desired behaviour: The Plugin2.Component1Editor
renders the inspector. But why? I don't want to trust that it will keep doing so unless I know why.
Thank you!