Author Topic: ImageButton Scale On Hovering  (Read 2953 times)

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
ImageButton Scale On Hovering
« on: March 09, 2013, 09:11:45 AM »
Hey there,

got again a weird problem with my Buttons. This time, there is no other plugin involed, just nGUI:

When i hover above my Buttons, they get bigger, meaning, that the Background-Sprite is changing it's values when i hover above them (Mouse and Finger), and i don't know why.

I have to mention, that the UIRoot-Object is a Prefab, don't know if that helps.


Edit: I wanted to mention, that they stay that way until i end the "Play"-Mode.

Edit2:
Second Question -

Why does nGUI make my Sprites bigger then they are when i click "Make Pixel-Perfect". I have a Sprite which is "249x264". When i create the Widget as a Sprite it comes out as "498x528" and stays that way, even if i hit "Make Pixel-Perfect", but i want it to stay in its original ratio. How can I accomplish that?
« Last Edit: March 09, 2013, 09:32:04 AM by BehindTheStone »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ImageButton Scale On Hovering
« Reply #1 on: March 09, 2013, 12:01:36 PM »
1. Because you have UIButtonScale on your buttons set to resize the background?

2. Because you chose a non-1 pixel size on your atlas.

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: ImageButton Scale On Hovering
« Reply #2 on: March 09, 2013, 12:09:52 PM »
1. I do not have the UIButtonScale-Component on my Buttons.

2. If i look at my Atlas it says "Pixel Size: 1"

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ImageButton Scale On Hovering
« Reply #3 on: March 09, 2013, 04:09:20 PM »
1. Yeah you do. It's the only thing that changes scale on hover. It's added by default when you create a new button.

2. If the pixel size is 1, and the scales are correct, then make pixel perfect will set your sprite to be the size of its pixels -- which in your case would be 249x264, according to you. Select your UIRoot and hit Alt+Shift+P.

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: ImageButton Scale On Hovering
« Reply #4 on: March 09, 2013, 04:52:21 PM »
1. Yes, that's right, but i did remove these components earlier.

2. Yeah, that did the job. Thanks! :)