- Home /
Custom Editor and OnSceneGUI
My setup
Custom Editor derived from UnityEditor::EditorWindow, and has a few buttons.
Custom Inspector derived from UnityEditor::Editor, which implements OnSceneGUI() and gives a visual representation of the data being edited.
My requirement
I want to update the sceneView when I click a button in the customEditor; in other words, trigger a call to OnSceneGUI when the button is clicked.
What I have done till now, is received a call in my custom Inspector following the button click. Currently I've tried dirtying the object in the scene so that the scene is redrawn. But it doesn't. I have to hover my mouse over the scene view to trigger the redraw.
The problem (what I think)
The focus is with the customEditor (following button click); hence the OnSceneGUI() is not called on the custom inspector.
Is my analysis of the problem correct? If yes, then bringing focus to the inspector should solve the problem. How do I do it?
Answer by vjoseph · Jun 09, 2012 at 03:05 PM
I've found the problem.
In my code, I was dirtying temporary objects in the scene that had the hideFlags = hideAndDontSave. On dirtying a object without this flag, the scene started refreshing on the press of the button.
Your answer
Follow this Question
Related Questions
Can the GameObjectInspector window be customized? 0 Answers
EditorGUILayout.PropertyField cannot draw custom class? 2 Answers
Inspector Overlapping Text Label at a Position 1 Answer
Custom editor window does not show prefab overrides 2 Answers
How to limit an ObjectField to assets with specific file extension 2 Answers