|
I am currently working on a custom EditorWindow for a particular type of GameObject. When I select different objects in the Hierarchy window, the custom window is updated to edit this new object. This all works fine, except the custom window doesn't redraw until I mouse-over it again. I've tried manually calling Repaint() on the window (didn't work), looked through the documentation and didn't see anything, so now I'm asking here. How can I repaint a custom EditorWindow when it's not the active focus? Thanks in advance.
(comments are locked)
|
|
...it always seems to work this way, doesn't it? I ask the question after hunting through all the docs, then the minute I post I find the answer :) For anyone looking at this in the future, EditorWindow.OnGUI() appears to only get called when the window is focused. Moving the Repaint() to EditorWindow.OnSelectionChanged() worked.
(comments are locked)
|
|
I've found that adding Repaint() to the Update function of your EditorWindow does the trick. This also has the added effect of repainting the editor window way more often than it does normally which I also found handy in my case. I suppose if you want your Repaint to be less intrusive you could put it in EditorWindow.OnInspectorUpdate() because it only gets called 10 times per second. That would probably be better for performance.
(comments are locked)
|
