IsPointerOverGameObject not working and it isnt the EventSystem

I am not getting any errors, IsPointerOverGameObject() is just always returning false. I did have the problem with the EventSystem and saw the fix of just placing it in the PersistantObjects.

I saw the issue with the canvas group on the Fader and I tried to place a canvas group on the HUD and Background and it didn’t change anything.

I am using the most recent version which is 2020.3 because I didn’t notice I was on that version when I started the project. It does look like IsPointerOverGameObject is no longer existing but previous topics/comments said the same thing but Brian said it is still around. This alongside no error from the compiler makes me think it is still “the law of the land” but has changed even though I cant find it in the current documentation.

Hi, sorry for the delay on this.

The first thing that I would check is to make sure that the Image components in your UI have their RayCast Target checked. This is what the Event System uses to determine if the EventSystem.current.IsPointerOverGameObject() is true.

IsPointerOverGameObject() itself has an issue if you use anything other than the mouse for input. Using it with touch screens requires extra work, you have to get the touch event, and pass that along to the method. This has caused us quite a bit of grief in the Inventory courses with Android and iOS applications. While this question is in the RPG section, if your build target is Android or iOS, the first section of this topic may be helpful:

No worries at all, I am fortunate that there is a lot more to be done in the final polish and I have a strong enough understanding to start a small project to implement what I have learned from this project and cement it in my brain.

I am currently following the tutorial and using the assets supplied by GameDev.tv and have not used any IOS/Android or mobile development on this.

I have double checked the Image and canvas groups on the background and HUD game objects and Raycast Target is checked and on Canvas Group Interactable is checked. I am still confused what could be the problem.

As am I. If you’re not using mobile, or touch, I can’t explain why IsPointerOverGameObject would fail.

Zip up your project and upload it to https://gdev.tv/projectupload and I’ll take a look. Be sure to remove the Library folder to save space.

Sorry I have been busy for the last few weeks and had to put this on the side for a short while. Anyway, thanks for all help! I just submitted it to the link and I also wanted to send a message here so the chat doesn’t close in case something else comes up.

I appreciate the patience, hope to hear from you soon Brian!

I scratched my head on this one quite a bit. It tursn out, the Event System needs a Standalone Input Module. If you open your PersistentObjectsPrefab, and select the Event System, you’ll find a button labelled “Add Default Input Modules”. Click on this button and an Input Module will be added to the EventSystem.
Save the Prefab, and the system should work right as rain.

Wow, that was the fix. I wonder if it is because I didn’t get an Event System spawned in the Hierarchy so I had to create my own empty game object with an event system. Maybe it spawns naturally with the Input Module already created.

Thank you so much for the help @Brian_Trotter! This has been driving me nuts for the last few days. But I was able to continue the project. Finishing with the last bit of polish and the last few bugs.

That may very well be the case. I don’t recall actually creating an Input Module, except when I use the new Input system in a project (and that’s a button to destroy the old input module and replace it with a new one.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms