- Home /
Error when trying to create a button in the editor
Hey,
I have been following some tutorials for a game and when trying to create a button in the editor, I get the error:
Assets/UI/Editor/AutomaticVerticalSizeEditor.cs(9,30): error CS0115: `AutomaticVerticalSizeEditor.onInspectorGUI()' is marked as an override but no suitable method found to override
This is the script:
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(AutomaticVerticalSize))]
public class AutomaticVerticalSizeEditor : Editor {
public override void onInspectorGUI() {
DrawDefaultInspector ();
GUILayout.Button ("Test Button");
}
}
This is the first time for me creating editor stuff so I really could use some help.
Thanks.
Comment
Best Answer
Answer by Mukabr · Aug 23, 2016 at 03:51 PM
OnInspectorGUI with capital O.
Also:
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(AutomaticVerticalSize))]
public class AutomaticVerticalSizeEditor : Editor {
public override void OnInspectorGUI() {
DrawDefaultInspector ();
if(GUILayout.Button ("Test Button")){
Debug.Log("clicked");
}
}
}
Your answer
Follow this Question
Related Questions
Ad units from Unity Ads appear very rarely 0 Answers
How do I do this?!(Google +1 Unity) 3 Answers
Loading a scene after a random amount of time. 1 Answer
Scene not loading properly on android device? 0 Answers
Add Listeners to array of Buttons 2 Answers