I’m using EventSystem.current.IsPointerOverGameObject() to detect if the mouse is over the GUI. In my case, I have a button that is being destroyed and replaced when clicked (as part of a re-render of several GUI objects). On the first click, IsPointerOverGameObject() catches the click just fine, but if the mouse isn’t moved and a second click is given, the click is not caught and goes through to the scene, as well as pressing the button.
It seems to be related to the mouse not being moved in combination with the GUI game objects being replaced. When I move the mouse in between clicks, everything works fine. It seems like the raycast calculation is only done when the mouse is moved, causing new objects to be “transparent” to clicks until the mouse is moved.
It’s also worth noting that this isn’t an issue with touch, only mouse.
Anyone have a solution for this? I’d not like to require the player to move the mouse after every click, that seems incredibly tedious.