- autoRepaintOnSceneChange
- BeginWindows
- Close
- EndWindows
- focusedWindow
- FocusWindowIfItsOpen.<T>
- FocusWindowIfItsOpen
- Focus
- GetWindow.<T>
- GetWindowWithRect.<T>
- GetWindowWithRect
- GetWindow
- mouseOverWindow
- OnDestroy
- OnFocus
- OnGUI
- OnHierarchyChange
- OnInspectorUpdate
- OnLostFocus
- OnProjectChange
- OnSelectionChange
- position
- RemoveNotification
- Repaint
- SendEvent
- ShowAuxWindow
- ShowNotification
- ShowPopup
- ShowTab
- ShowUtility
- Show
- Update
- wantsMouseMove
EditorWindow.BeginWindows 开始窗口
function BeginWindows () : void
Description描述
Mark the beginning area of all popup windows.
标记所有弹出窗口的开始区域。
GUI.Window behaves somewhat differently in the editor than inside your games. In games, GUI.Window pops up a window on your screen. In the editor, GUI.Window shows a subwindow inside one of your editor windows. Begin/EndWindows is used to determine where these can go. You need to have all calls to GUI.Window or GUILayout.Window inside a BeginWindows / EndWindows pair. Like this:
GUI.Window的行为在编辑器中比在游戏中有所不同。在游戏中,GUI.Window在屏幕上弹出一个窗口;在编辑器中,GUI.Window在编辑器窗口中显示一个子窗口。Begin/EndWindows用于定义窗口。你需要让所有调用的GUI.Window或GUILayout.Window在BeginWindows / EndWindows对内。
Simple editor Window with a window and a button inside.
带有一个窗口和一个按钮的简单编辑器窗口。
class GUIWindowDemo extends EditorWindow {
// The position of the window
//窗口的位置
var windowRect = Rect (100,100,200,200);
// Main GUI Function //主GUI函数
function OnGUI () {
// Begin Window
BeginWindows ();
// All GUI.Window or GUILayout.Window must come inside here
//所有GUI.Window 或 GUILayout.Window 必须在这里面
windowRect = GUILayout.Window (1, windowRect, DoWindow, "Hi There");
// Collect all the windows between the two.
//在这两者之间搜集所有窗口
EndWindows ();
}
// The window function. This works just like ingame GUI.Window
//窗口函数,这就像游戏内的GUI.Window
function DoWindow () {
GUILayout.Button ("Hi");
GUI.DragWindow ();
}
// Add menu item to show this demo.
//添加菜单项来显示这个演示
@MenuItem ("Test/GUIWindow Demo")
static function Init () {
EditorWindow.GetWindow (GUIWindowDemo);
}
}
The placement of the BeginWindows / EndWindows pair determines where popup windows will appear; all windows are clipped to the clipping area defined by GUI.BeginGroup or GUI.BeginScrollview. A small example of that
BeginWindows / EndWindows对的放置决定弹出窗口的显示。所有窗口都放到GUI.BeginGroup 或 GUI.BeginScrollview中定义。一个简单的例子:
Simple editor window with a window and a button inside using scroll bars.
带有一个窗口和一个按钮,使用滚动条的简单编辑器窗口。
class GUIWindowDemo2 extends EditorWindow {
// The position of the window
//窗口的位置
var windowRect = Rect (100,100,200,200);
// Scroll position 滚动位置
var scrollPos = Vector2.zero;
function OnGUI () {
// Set up a scroll view 设置滚动视图
scrollPos = GUI.BeginScrollView (
new Rect (0, 0, position.width, position.height),
scrollPos,
new Rect (0, 0, 1000, 1000)
);
// Same code as before - make a window. Only now, it's INSIDE the scrollview
//创建一个窗口,仅限在,在滚动视图中
BeginWindows ();
windowRect = GUILayout.Window (1, windowRect, DoWindow, "Hi There");
EndWindows ();
// Close the scroll view 关闭滚动视图
GUI.EndScrollView ();
}
function DoWindow () {
GUILayout.Button ("Hi");
GUI.DragWindow ();
}
@MenuItem ("Test/GUIWindow Demo 2")
static function Init () {
EditorWindow.GetWindow (GUIWindowDemo2);
}
}