- Home /
Question by
JonnyBolton · Dec 26, 2016 at 02:12 PM ·
editorcustom editorcustom-inspectorcustom-editor
Handles not displaying
I am trying to add some handles to a GameObject, but they are not showing up in the scene view at all. I believe the following code should be adding a label to the position of the GameObject in the scene view, but nothing is showing up. The GameObject has a Test component attached.
using UnityEditor;
public class TestInspector : Editor {
void OnSceneGUI () {
Test test = target as Test;
Handles.Label (test.transform.position, "LABEL TEXT");
}
}
This is what I see in the scene view.
It is not just labels that are the problem. I have tried drawing lines and arrows but nothing is showing up at all.
I've tested this in Unity versions 5.4.0f3 and 5.5.0f3.
Comment
I should point out that the above script is sitting inside an "Editor" folder in the project.
Answer by Adam-Mechtley · Dec 27, 2016 at 05:35 PM
Do you need to add CustomEditor to TestInspector?
Yes, I think it's missing the attribute:
[CustomEditor(typeof(Test))]
public class TestInspector : Editor {
void OnSceneGUI () {
Test test = target as Test;
Handles.Label (test.transform.position, "LABEL TEXT");
}
}