- Home /
Force EventSystem to updating when application not in focus
Hey folks!
I've found that the EventSystem doesn't continue to update PointerEventData when the application window is no longer in focus. It also sets the 'EventSystem.isFocused' value to false. Input.mousePosition still gives the correct values however, and buttons are still hovering.
Is there a way to force the EventSystem to essentially ignore the 'isFocused' flag and continue processing events when the application is out of focus?
'Run In Background' is enabled already.
Answer by Zaeran · Sep 09, 2020 at 03:58 PM
Looks like I have a solution.
PointerEventData d = new PointerEventData(EventSystem.current);
d.position = Input.mousePosition;
By creating a new PointerEventData and manually setting the mouse position, it will allow the 'd' variable to be used in the GraphicsRaycaster class for UI input.
Your answer
Follow this Question
Related Questions
What is the alternative to lastSelectedGameObject? 0 Answers
UI Element Got & Lost Focus Handling 2 Answers
How to add callback for button press to a private function (New UI)? 1 Answer
InputField instance isFocused always return false. 0 Answers
ScreenPointToLocalPointInRectangle not giving output 1 Answer