How to activate UI element on mouse over?

Hi All,

Just working on a school project and I came into an issue.
Previously I’ve used on mouse over to make text activate/deactivate in the game world. However it doesn’t seem to work on UI features. I was attempting to make a semi-transparent panel activate/deactivate on mouse over for a UI effect. Does anyone know what I need to do to make this happen? I have heard of on pointer enter, will this accomplish what I need?

Many thanks in advance.


Using SetActive(true) or (false) is used in GameObjects, to activate and deactivate the whole gameobjects and all its componentes.

But you can enable/disable specyfic compoentns like this:

Object.GetComponent<Renderer>().enable = true; (or false)

Then you say " However it doesn’t seem to work on UI features" and thats not true. What is happening i supose, is that you are trying to activate a object from a script in that object, and that object is not active, so the script is not active adn can not detect the mouse!

You need to rethink it! You can not deactivate the whole object if want the script to be enabled… If its a UI element, you can simple enable=false the Image compoenent , or rendere component, so it will be “inivisible” but it will be there running the script waiting to detect the mouse.

Understand?? :smiley:

Good luck!