function Focus () : void
Description
Moves keyboard focus to this EditorWindow.
See Also: focusedWindow.
Focus one window by pressing the button on other window.
class Window1
extends EditorWindow {
static var instance;
@
MenuItem(
"Example/Show Focus Usage/Window1")
static function Init() {
var window =
EditorWindow.GetWindow(Window1);
}
function Window1() {
instance = this;
}
function OnGUI() {
if(
GUILayout.Button(
"Focus the other window!")) {
Window2.instance.Focus();
}
}
}
And on another file:
class Window2
extends EditorWindow {
static var instance;
@
MenuItem(
"Example/Show Focus Usage/Window2")
static function Init() {
var window =
EditorWindow.GetWindow(Window2);
}
function Window2() {
instance = this;
}
function OnGUI() {
if(
GUILayout.Button(
"Focus the other window!")) {
Window1.instance.Focus();
}
}
}