Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity OnMouseEnter() or OnMouseOver() not working

I want to make an Inventory System in Unity, so I tried to follow this tutorial, but the functions OnMouseEnter and OnMouseOver are not working.

I tried everything like 3d colliders with z-value of 100, with trigger and not trigger, and also I checked if the Physics.queriesHitTriggers is true, but nothing works. Do you have any easy tips?

Not with raycasting... I'm quite new and don't understand this.

like image 653
Mika Avatar asked Jan 26 '26 15:01

Mika


1 Answers

  • Try adding a box collider or box collider 2d

  • Try adding an rigidbody besides the collider and you can do it kinematic

  • Try adding add a EventSystem if you are using canvas ui

  • And verify that it does not have an object like a canvas blocking the camera raycast.

good luck.

like image 56
Daniel Pernia Avatar answered Jan 29 '26 11:01

Daniel Pernia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!