• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Tojteusz · Jul 20, 2014 at 03:16 PM · guigui textgui stylegui skin

On hover GUI text change position.

How make button with the effect, when mouse is hovering it text go 5px up?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image robertbu · Jul 21, 2014 at 03:26 AM 0
Share

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.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tojteusz · Jul 20, 2014 at 11:49 PM 0
Share

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.

avatar image CScherer549 · Jul 21, 2014 at 11:58 PM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

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

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges