- Home /
Extending ButtonEditor
In the source for UI Button inspector, ButtonEditor, they simple extend SelectableEditor like so:
[CustomEditor(typeof(Button), true)]
[CanEditMultipleObjects]
public class ButtonEditor : SelectableEditor
But when I try the same thing:
[CustomEditor(typeof(MyButton), true)]
[CanEditMultipleObjects]
public class MyButtonEditor : ButtonEditor
It gives an error for CustomEditor "Constuctor has 0 parameters but is invoked with 2 arguments" and an error saying ButtonEditor doesn't exist. Also "using UnityEditor.UI" tells me UI doesn't exist.
The reason I'm trying to do this, is because I want to be able to set the selected state of the button so I can select multiple at once. I've tried to use Toggle but that doesn't work well for my purposes. The function controlling the selected state is protected so I have to extend the button and if I want to change the functionality. The custom inspector for the button then hides my any public variables from MyButton in the editor.
Answer by KuroiRoy · May 08, 2015 at 09:55 AM
I've found the answer in another question.
http://answers.unity3d.com/questions/847994/unityeditorui-reference-missing.html
Your answer
Follow this Question
Related Questions
Custom Editor Window Nodes Unresponsive Button 1 Answer
Custom Editor Button Style like the one in the Hierarchy 0 Answers
Handles.Button unresponsive in custom editor after custom asset serialization 2 Answers
How can i create a button in a custom class with UnityEditor using custom editor? 0 Answers
custom button 2 Answers