Button hover with GUISkin has wrong hotspot

Hi all!

I was tinkering around with the buttons with a custom GUISkins and I noticed that the hotspot for the button hover is wrongly placed (triggers lower than the actual button is placed). Buttons higher up on the page isn’t so bad, but the further down on the page the button is situated, the worse it gets. At worst, the button highlights far below the button itself.

Does anybody know why this happens?

I’m building the projekt as a standalone app on a Mac.

That shouldn’t happen. Button should trigger inside its (Rect) bounds.

Could you post any screenshots?

Here is a screenshot, I rewrote the code to use GUILayout and a selectGrid and the hotspot is now above the buttons but the error can still clearly be seen. The error is only visible when I build to an app but not when test-running in the Unity-editor.

Can’t see any screenshot, sorry. The forum has sporadic problems displaying images.

Okey, here is a imgur-link instead: http://i.imgur.com/eF7vX8h.jpg

Oh, seeing you are using GUILayout. Well - don’t! It has performance issues.

Try rendering buttons using GUI.Button (do your own math for calculating the button coordinates).

Here are the two examples script I previously wrote, similar to the subject:

http://forum.unity3d.com/threads/113438-Centering-GUI?p=1150803&viewfull=1#post1150803
http://forum.unity3d.com/threads/168443-Question-Image-based-gui-issue?p=1152661&viewfull=1#post1152661

If this doesn’t help, check out your GUISkin/GUIStyle, your button image etc.

Solved the problem; if I set the screen resolution to 800 x 600 (previously 1024 x 768) and open the app in windowed more, the hotspot works.

Thanks for the tips!