EditorWindow
- 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.OnLostFocus 当失去焦点
function OnLostFocus () : void
Description描述
Called when the window loses keyboard focus.
当窗口失去键盘焦点时调用。
参见:OnFocus.
Restores normal view when you lose focus on this window.
当丢失这个窗口焦点时,恢复正常视图。
// Simple script that lets you preview your main camera in Orthographic view
// when selected.
//当选择时,在正交视图预览主相机
class OrthographicPreviewer extends EditorWindow {
var renderTexture : RenderTexture;
var camera = Camera.main;
@MenuItem("Example/Camera Selector")
static function Init() {
var window = GetWindow(OrthographicPreviewer);
window.Show();
}
function Awake () {
renderTexture =
new RenderTexture(position.width, position.height, RenderTextureFormat.ARGB32 );
}
function OnInspectorUpdate() {
this.Repaint();
}
function OnGUI() {
if(GUILayout.Button("Close")) {
camera.orthographic = false;
this.Close();
}
GUI.DrawTexture(Rect( 0.0f, 50.0f, position.width, position.height), renderTexture);
}
function OnFocus() {
Selection.activeTransform = camera.transform;
camera.orthographic = true;
}
function Update() {
if(camera != null) {
camera.targetTexture = renderTexture;
camera.Render();
camera.targetTexture = null;
}
if(renderTexture.width != position.width || renderTexture.height != position.height)
renderTexture = new RenderTexture(position.width,
position.height,
RenderTextureFormat.ARGB32 );
}
function OnLostFocus() {
camera.orthographic = false;
}
}
最后修改:2011年6月24日 Friday 15:02