- Home /
CustomEditor: Why OnSceneGui stops working when I collapse related component in Inspector?
I have the CustomEditor for a component. OnSceneGui works only when I have selected component - that's fine. But why on scene behavior depends on showing Inspector for this component? Collapsing/expanding the component in the inspector controls "OnSceneGUI".
Can I somehow make OnSceneGUI independent from this? So it always works when the gameObject with the component is selected?
I'm unable to reproduce your problem with this
[CustomEditor(typeof(Example))]
public class ExampleEditor : Editor
{
private void OnSceneGUI()
{
Handles.DrawLine(Vector3.zero, Vector3.up * 2);
}
}
It will only get called when the gameobject with the Example.cs component attached is selected. That includes multi selection.
@myzzie Hmm... You are right. Created new project and everything works fine. Will have to find where I shot myself in the leg then =) Thank you for taking time to check.
Your answer
Follow this Question
Related Questions
Custom Editor item list 1 Answer
How can I draw the default widget for a field in a CustomEditor? 2 Answers
Nesting custom inspectors 0 Answers
DrawDefaultInspector crash 1 Answer
Get CustomEditor for Script 0 Answers