- Home /
On hover GUI text change position.
How make button with the effect, when mouse is hovering it text go 5px up?
I'm not a GUI expert since I use EZGUI for my interface work, but I crawled through the reference. I did not find a clear way to make it happen. Even with the CSchere549's approach, I could not find a easy way to just move the text up. It is pretty easy to change the font and/or change the background image for a hover, but I couldn't find anything to move just the just the text. The only way I could figure out to make it happen was pretty hacky.
Answer by CScherer549 · Jul 20, 2014 at 07:27 PM
Check if the mouse position is within the bounds of that button, that's the only way I know of doing it. Use Input.MousePosition and the values of the Rect that make up the button.
Sorry, but i have a lot of buttons and that methods its to hard to implement. I'm searching something more automatic for all buttons.
Unfortunately this seems to be the best way to do it at the moment, as the Unity GUI doesn't seem to have a built in OnHover function.
Your answer
![](https://koobas.hobune.stream/wayback/20220613154538im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Gui Layout Interface 0 Answers
Positioning a GUI Text? 2 Answers
GUI text help with adding numbers 2 Answers
Can I set a specific font for a specific font style? 1 Answer
help with Gui texts 2 Answers