I’ve noticed that if I have my game in the background, with another window on top of it, moving my mouse around triggers OnPointerEnter events, as though the mouse cursor is x-raying the window in front and still seeing the game.
Is this considered a bug? Or is there a way to disable this across the board? I’ve found that I can ignore this on a per-case basis if my OnPointerEnter() method checks for Application.isFocused, but that doesn’t address 3rd party tools, and it’s a bit annoying to have to put that check everywhere.
Is there a way to prevent this unwanted behavior?
That smells a bit like it’s intended via the operating system… and it varies by app and OS and version of app.
You’ll notice the behaviour with certain other apps when they are covered and you move the mouse over responsive parts of them. I think for most part the underlying non-focused app still gets mouse-over events.
Perhaps you could just put up (or enable) a giant invisible Graphic that has Raycast Target checked when your app loses focus, then remove it when you gain focus??
That seems a bit scary. I’m picturing someone alt-tabbing between two programs, and finding that all of their inputs are going to both windows at the same time. Seems like a very delicate/fragile way for things to work, if it’s intended. On the other hand, I know programs will still handle keyboard input even if they’re not focused, like how I can start OBS recording with a keyboard shortcut when it’s in the background. So, maybe that’s all by design.
That does sound pretty simple. Thanks.