Search Unity

Alignment problem when hovering over a button using onmouseenter

Discussion in 'Immediate Mode GUI (IMGUI)' started by Kre8or, Mar 23, 2015.

  1. Kre8or

    Kre8or

    Joined:
    Mar 15, 2014
    Posts:
    31
    Hi, I found what seems to be a bug of some kind because the same script works fine in many other scenes. It has to be something else. What controls where the mouse is hovering over a button? It's working but is off on the Y axis by at least the buttons height.

    I checked other working scenes to make sure the camera is the same, and that I built the buttons the same. Made them by zeroing out pixel insets for the guitexture and using transform only, to place the texture. I attach the script to make it a button. What can you do to effect NOT having the mouse over image when the mouse cursor IS over the image? How can I move it to align it back? Thanks in advance.

    Code (CSharp):
    1. public Texture2D button;
    2. public Texture2D hoverOverButton;
    3.  
    4. void OnMouseEnter ()
    5. {
    6.  
    7. guiTexture.texture = hoverOverButton;
    8. }
    9. void OnMouseExit()
    10. {
    11. guiTexture.texture = button;
    12. }
     
    Last edited: Mar 24, 2015
  2. Kre8or

    Kre8or

    Joined:
    Mar 15, 2014
    Posts:
    31
    I think I got it now. Was using a png with transparency by mistake. :(