Not Working? Why?
[CustomEditor(typeof(Button))]
public class ButtonOverride : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.HelpBox(“Hello”, MessageType.Info);
}
}
Not Working? Why?
[CustomEditor(typeof(Button))]
public class ButtonOverride : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.HelpBox(“Hello”, MessageType.Info);
}
}
The Button component has it’s own editor, i think that it is loaded after your own code is being loaded, so it is effectively overriding your custom editor.
Here’s a cool hack (just tested this): place the same code you posted as a compiled DLL.
The original editor for Button is defined in UnityEditor.UI.dll, so you should create your DLL with a name that will be processed after that (i assume the libraries are processed in alphabetical order).
I made a DLL called ZEditor.dll and placed it under Assets/Editor and it worked fine
Not ideal, since nobody guarantees anything about the order that these are processed, but this seems to work fine.
What is this mean.Are you know?
If you create a new library, you should add the Unity DLLs as references (UnityEngine.dll, UnityEditor.dll are the bare minimum)
I forgot the unityengine.dll
Yes.it worked : D Thanks.Have a nice day!