TMPro UI elements not blocking raycasts

Hey everyone, I’m having a bit (lot) of trouble at the moment.
I can’t seem to make TMPro UI elements block raycasts and any normal UI elements for that matter. Even the unityengine.eventsystems.eventsystem.current.ispointerovergameobject() method won’t work at all and I’ve tried searching for hours for another solution, but alas, I haven’t found any.

Please help!

Does your canvas have a graphics raycaster component, and do the ui elements have Raycast Target checked?

Okay, I was a doof and I found out my problem:

I was putting the pointer over game object code in the wrong script!

(Unbelievable!)