private void Update() { if (m_skipUpdate) { m_skipUpdate = false; return; } if (!m_editor.IsInputFieldActive) { if (m_dialogManager.IsDialogOpened) { if (m_editor.Input.GetKeyDown(KeyCode.Escape)) { m_dialogManager.CloseDialog(); } } } m_editor.UpdateCurrentInputField(); EnableOrDisableRaycasts(); bool mwheel = false; if (m_zAxis != Mathf.CeilToInt(Mathf.Abs(Input.GetAxis(InputAxis.Z)))) { mwheel = m_zAxis == 0; m_zAxis = Mathf.CeilToInt(Mathf.Abs(Input.GetAxis(InputAxis.Z))); } bool pointerDownOrUp = Input.GetPointerDown(0) || Input.GetPointerDown(1) || Input.GetPointerDown(2) || Input.GetPointerUp(0); bool canActivate = pointerDownOrUp || mwheel || Input.IsAnyKeyDown() && (CurrentInputField == null || !CurrentInputField.isFocused); if (canActivate) { PointerEventData pointerEventData = new PointerEventData(m_editor.EventSystem); pointerEventData.position = Input.GetPointerXY(0); List <RaycastResult> results = new List <RaycastResult>(); Raycaster.Raycast(pointerEventData, results); RectTransform activeRectTransform = GetRegionTransform(ActiveWindow); bool activeWindowContainsScreenPoint = activeRectTransform != null && RectTransformUtility.RectangleContainsScreenPoint(activeRectTransform, Input.GetPointerXY(0), Raycaster.eventCamera); if (!results.Any(r => r.gameObject.GetComponent <Menu>())) { foreach (Region region in results.Select(r => r.gameObject.GetComponentInParent <Region>()).Where(r => r != null).OrderBy(r => r.transform.localPosition.z)) { RuntimeWindow window = region.ActiveContent != null?region.ActiveContent.GetComponentInChildren <RuntimeWindow>() : region.ContentPanel.GetComponentInChildren <RuntimeWindow>(); if (window != null && (!activeWindowContainsScreenPoint || window.Depth >= ActiveWindow.Depth)) { if (m_editor.Contains(window)) { if (pointerDownOrUp || window.ActivateOnAnyKey) { if (window != null && window.WindowType == RuntimeWindowType.Scene) { IEnumerable <Selectable> selectables = results.Select(r => r.gameObject.GetComponent <Selectable>()).Where(s => s != null); int count = selectables.Count(); if (count >= 1) { RuntimeSelectionComponentUI selectionComponentUI = selectables.First() as RuntimeSelectionComponentUI; if (selectionComponentUI != null) { selectionComponentUI.Select(); } } } if (window != ActiveWindow) { m_editor.ActivateWindow(window); region.MoveRegionToForeground(); } } break; } } } } } }