- Home /
Question by
Alex-Chouls · Feb 09, 2012 at 10:28 PM ·
editorwindowtabsdocked
How to tell if a docked EditorWindow got focus?
Docked editor windows don't seem to get OnFocus/OnLostFocus events as you switch between tabs. Is there a workaround anyone would like to share? :)
Comment
Answer by numberkruncher · Jun 19, 2013 at 02:07 AM
There might be a dirty workaround:
class DemoEditorWindow : EditorWindow {
private bool _focused;
private void OnFocus() {
_focused = true;
}
private void OnLostFocus() {
_focused = false;
}
private void Update() {
// Did get focus?
if (this == focusedWindow) {
if (!_focused)
OnFocus();
}
else if (_focused) {
OnLostFocus();
}
}
}
Warning: Not tested! but you should hopefully get my general theory:
Your answer
Follow this Question
Related Questions
Is there an EditorWindow is docked value? 2 Answers
How do I add multiple "tabs" to an editorwindow 3 Answers
BUG REPORT: Editor Docked windows do not change focus properly. 0 Answers
how to create tab in your one window 0 Answers
Repainting an EditorWindow when it's not the current focus? 3 Answers