Is "IsPointerOverGameObject" Deprecated in Unity 2019.2+?

September 2024 ยท 1 minute read

I'm trying to detect if my cursor is over a UI element in the scene (not in the editor). In past versions, I could just use EventSystems.EventSystem.IsPointerOverGameObject(), but it seems that EventSystems no longer exists as a part of UnityEngine.

Looking at the documenation for 2019.2, UnityEngine.EventSystems is not there, but in 2019.1 it is. The release notes make no mention of this that i can see. Just gone.

So, how am I to detect when a cursor is over a UI element?

1

1 Answer

Alright, this was unrelated to the documentation. EventSystem clearly still exists because it exists in my scene. Another cursory look revealed that my IDE was giving me trouble which lead to errors in the debugger.

The best way to get at this is still EventSystem.current.IsPointerOverGameObject(), and make sure you are using UnityEngine.EventSystems.

However, the documentation is STILL missing it.

3

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobWtuZ259doKOoqpmoaOlvKq6056pqK6Vp7SiucSomaOdk6l6pbHPq5ycmaSasW61zWasp6GkrnpzfJByZGs%3D