- Home /
OnPointerEnter & OnPointerExit NOT WORKING
Hi,
First time using these functions. Docs say they fire when Mouse hovers over or leaves a GameObject. I have a GameObject on stage with a Sprite attached to it. In second case, i have an Image in the Canvas. Nothing fires when i hover my mouse over either of them (stage Sprite / Canvas Image).
Unity 2018.3.0f2
Info on the interface and methods: https://docs.unity3d.com/ScriptReference/EventSystems.IPointerEnterHandler.html
QUESTION: Anyone with an idea why it doesn't work in the above cases, or how to use these properly? ( i cant find a mistake on my side, it looks too simple to mess something up!)
Answer by _watcher_ · May 04, 2019 at 08:20 AM
@RobAnthem: Upvoted for trying to help, thanks. Also sorry for late reply.
The reason the dragging was not working (and i made it work now using this approach is that i forgot to enable "Raycast Target" on the UI Image. Basically you need to have the target on which the script resides receive Raycasts so that it can react to clicks/touches. Basic mistake. Cheers