Question by
clankill3r · Jun 08, 2020 at 05:05 PM ·
gui
OnInspectorGUI not working
I have a gameObject with a script called Hero which looks like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Hero : MonoBehaviour {
public int health = 100;
void Start(){
}
void Update(){
}
}
I also have this editor script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class GUI_Helper : Editor
{
[CustomEditor(typeof(Hero))]
public override void OnInspectorGUI()
{
Debug.Log("Unity please show me a label");
GUILayout.Label ("This is a Label in a Custom Editor");
GUILayout.Button("click me");
}
}
But I never see the gui. Am I doing something wrong?
unity-problem-gui.png
(22.6 kB)
Comment
Best Answer
Answer by CodesCove · Jun 23, 2020 at 10:51 PM
CustomEditor attribute goes before the class definition (public class GUI_Helper : Editor), not where it is now.
Your answer
Follow this Question
Related Questions
GUI texture not showing up in unity 5? 1 Answer
How to change GUI label size 1 Answer
How can i make a timer kinda like timber man ? 0 Answers
9 Slice image gets pixelated 2 Answers
UI Text Editing Problem, What's Wrong? Need Anybody to Assist 1 Answer