I have implemented a button on my own, which inherits from UnityEngine.UI.Button, and it has its own custom inspector.
public class TwoStateButton : Button
{
...
}
[CustomEditor(typeof(TwoStateButton))]
public class TwoStateButtonEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
}
...
}
I have an issue where the behaviour of the Transition mode settings in the Button inspector is not working properly for my class TwoStateButton as long as I have a custom editor.
The Button inspector looks like this, and so does the TwoStateButton inspector if I delete or comment out the custom editor class.
But my custom inspector looks like this, despite me not making any changes to the inspector.
So basically, the behaviour with what fields are visible changes depending on the Transition mode is lost, and all settings are always shown.
I have tried exchanging base.OnInspectorGUI(); with DrawDefaultInspector(); but it had no effect. I have tried importing the UnityEditor.UI library and making my TwoStateButtonEditor inherit from ButtonEditor instead of Editor, but it had no effect.
Is there a way to make a custom editor, but still keep the Transition mode settings behaviour?