Author Topic: UITexture MakePixelPerfect() may need pixelSize  (Read 2885 times)

Asse

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 70
    • View Profile
UITexture MakePixelPerfect() may need pixelSize
« on: August 06, 2012, 03:41:10 AM »
When using reference atlases you need to specify the pixelSize in order to scale the widgets accordingly. But when you have a UITexture inside your ui and use different textures with different resolutions you can't specify the pixelSize and it scales incorrect. I wrote myself a helper script that takes an atlas and looksups its pixelSize but I think a builtin solution would be way better  ::)

simon129

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 20
    • View Profile
Re: UITexture MakePixelPerfect() may need pixelSize
« Reply #1 on: August 06, 2012, 09:15:24 PM »
Everything under UIRoot is pixel-based.

Local scale X/Y = pixel width/pixel height.

Just adjust local scale.

Asse

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 70
    • View Profile
Re: UITexture MakePixelPerfect() may need pixelSize
« Reply #2 on: August 07, 2012, 03:01:05 AM »
Yes that's correct. But when you use reference atlases you define a pixelSize, e.g. an hd atlas being twice of the original size has a pixelSize of 0.5 which is taken into account when using MakePixelPerfect by NGUI. This is missing with UITexture.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture MakePixelPerfect() may need pixelSize
« Reply #3 on: August 07, 2012, 12:03:35 PM »
With UITextures not being a part of the atlas, the question is where would this scale come from... Custom component to scale it might just be the way to go.

Asse

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 70
    • View Profile
Re: UITexture MakePixelPerfect() may need pixelSize
« Reply #4 on: August 07, 2012, 12:04:35 PM »
Ok, so I will retain as is.