Version: 2017.1
public void Focus ();

説明

エディターウィンドウにキーボードフォーカスを当てます

See Also: focusedWindow.


Focus one window by pressing the button on other window.

// Simple Editor Window that when clicked focuses another window.
//
// Usage: Open both windows (Window 1 and Window 2) and just press the button
// to see how the focus changes

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(); } } }

他の例:

// Simple Editor Window that when clicked focuses another window.
//
// Usage: Open both windows (Window 1 and Window 2) and just press the button
// to see how the focus changes

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(); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961