Author Topic: new UIButton update  (Read 2545 times)

johanesnw

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 22
    • View Profile
new UIButton update
« on: March 02, 2014, 10:08:41 AM »
about the latest update, where UI Button and UI image button becomes one.
It really hurts my project. really...  :'( :'( :'(
all my uibutton that goes with uisprite goes crazy. the sprite dimension sets to its original size.
i tried to set the dimension manually but whenever i start the game it turns back to original size
(say I have a weapon 200x150 and i made it 50x50 for shop icon purpose. and after updating NGUI, every icon in shop turns to 200x150)
after about 15mins I realized that UIButton, sprite section, has its "pixel snap" enabled. disable it, resize dimension, and a button will be right like before.
but I have about 100+ in total (50~ weapon icon in shop, 60~ enemy icon in 'enemypedia', and alot for UIs)
that takes hours to disable each snap pixels, resizing dimensions, and sometimes eyeballing its size.

Maybe you can consider disabling the "pixel snap" for default preset, so that others won't get to this problem.
but I don't know if there are more user that prefer pixel snap enabled.


one question:
How can you set the sprite in the new uibutton to  "None"?
i've accidentally picked sprite for hovering, and the result is no good.
theres no option to delete it so I re-add the component  :P

Thanks. other updates are good anyway  ;D

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: new UIButton update
« Reply #1 on: March 02, 2014, 06:24:12 PM »
Change UIButton.SetSprite function to this:
  1.         protected void SetSprite (string sp)
  2.         {
  3.                 if (mSprite != null && !string.IsNullOrEmpty(sp) && mSprite.spriteName != sp)
  4.                 {
  5.                         mSprite.spriteName = sp;
  6.                         if (pixelSnap) mSprite.MakePixelPerfect();
  7.                 }
  8.         }
I'll release it as a patch tonight as well.