void Update() { wasNoButtonOrTouchPressed = wasNoButtonOrTouchPressed || !InputUtils.AnyKeyboardOrMouseOrTouchPressed(); if (!isMovedIntoCanvas && RectTransform.rect.width > 0 && RectTransform.rect.height > 0) { isMovedIntoCanvas = true; MoveInsideCanvas(); } }
private void OnDestroy() { // Remove this ContextMenu from the list of opened ContextMenus only after all Input has been released // to avoid triggering additional actions (e.g. onClick of button). if (CoroutineManager.Instance != null) { CoroutineManager.Instance.StartCoroutineAlsoForEditor( CoroutineUtils.ExecuteWhenConditionIsTrue( () => !InputUtils.AnyKeyboardOrMouseOrTouchPressed(), () => RemoveOpenContextMenuFromList(this))); } else { RemoveOpenContextMenuFromList(this); } }