- Select the desired UI Button
- Scroll down the inspector and click the “Add Component” button
- In the list of components that will appear, select “Event” and then “Event Trigger”
- You will notice that a new “Event Trigger” area appears in the inspector for the button
- There, click on the “Add new even type” button
- A list of even types will pop-up. Choose “PointerEnter”
- Next, on the “PointerEnter” sub-area that will appear within the “Event Trigger” area in the inspector (when your button is selected, of course), click on ‘+’ to add a new item to the list of events
- add the function
https://gamedev.stackexchange.com/questions/116801/how-to-display-text-when-mouse-hover-button-in-unity-3d