Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Asse on August 06, 2012, 03:41:10 AM

Title: UITexture MakePixelPerfect() may need pixelSize
Post by: Asse 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  ::)
Title: Re: UITexture MakePixelPerfect() may need pixelSize
Post by: simon129 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.
Title: Re: UITexture MakePixelPerfect() may need pixelSize
Post by: Asse 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.
Title: Re: UITexture MakePixelPerfect() may need pixelSize
Post by: ArenMook 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.
Title: Re: UITexture MakePixelPerfect() may need pixelSize
Post by: Asse on August 07, 2012, 12:04:35 PM
Ok, so I will retain as is.