Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Evil-Dog on May 04, 2014, 09:52:24 AM

Title: Unable to setup proper UI scaling and anchors on iPad
Post by: Evil-Dog on May 04, 2014, 09:52:24 AM
Hi, I'm having problem setting the UI to appear correctly on PC and on the iPad 4.  So I tried all combinations of PixelPerfect, FixedSizeOnMobiles and Adjust by DPI but can't get satisfying results.  PixelPerfect has the proper anchoring but everything is way too small, which I understand the desired results you'll get on higher resolution, but I want the UI scale to be relative. FixedSizeOnMobiles with my base height of 768 looks better, the scale is right but every elements anchored to the left, right, top and bottom of the UIRoot are off screen.

Maybe I don't understand something basic with this system but can you enlighten me?
Thanks a bunch
Title: Re: Unable to setup proper UI scaling and anchors on iPad
Post by: ArenMook on May 04, 2014, 10:59:31 AM
How are the elements anchored? Fixed size or not fixed size, anchoring should work regardless.
Title: Re: Unable to setup proper UI scaling and anchors on iPad
Post by: Evil-Dog on May 04, 2014, 02:02:35 PM
Yeah I would think so, on PC it works in all resolutions no problem there.  For instance, our top panel is anchored like this
Unified
OnUpdate
UIRoot
Left: Left 0
Right: Right 0
Bottom: Top -40
Top: Top 0
Title: Re: Unable to setup proper UI scaling and anchors on iPad
Post by: ArenMook on May 05, 2014, 10:15:11 PM
That seems fine to me. The sprite will be anchored to the top of the screen and will stretch so it's always from left to right. OnUpdate type updates mean the values get calculated every frame. What is the widget anchored to? Did you try anchoring directly to the camera?
Title: Re: Unable to setup proper UI scaling and anchors on iPad
Post by: Evil-Dog on May 05, 2014, 10:23:43 PM
Yeah I know what all the anchoring parameters do, it all works fine in different situations on different targets and everything on PC but not on the iPad.

The anchor target is the UIRoot, I can try on the cam.  It's all fine in FixedSizeOnMobiles when setting the manual height to 1536, but that makes the interface very tiny.  If I set it to 768, which is half, I would think the interface would be scaled by 2, no?  How do I get my interface at a higher scale while maintaining the anchors?
Title: Re: Unable to setup proper UI scaling and anchors on iPad
Post by: Evil-Dog on May 05, 2014, 11:04:08 PM
Seems to work better when anchored to the camera. But there's a margin on all sides.  I mean, designing a UI and then scaling it up if you're on a bigger resolution so it's not tiny is a basic need, so what's the standard way to have the same interface on a ipad1 and ipad2-3-4? Like if I have a button as big as my thumb on the ipad 1 and I want the button still the size of my thumb on ipad 2-3-4 :)
Title: Re: Unable to setup proper UI scaling and anchors on iPad
Post by: ArenMook on May 06, 2014, 12:00:08 AM
All I can think of is that you have a part of your UI scaled. That's the only reason things wouldn't line up. Check the scales of objects leading up to your anchored widget. They must all be (1, 1, 1) with the sole exception of UIRoot.
Title: Re: Unable to setup proper UI scaling and anchors on iPad
Post by: Evil-Dog on May 06, 2014, 12:45:01 AM
The hierarchy was like this
TopicView (gameobject scale 1,1,1, this one had a UIPanel I DON'T KNOW WHY)
    Interface (gameobject scale 1,1,1)
        UIRoot
            HeaderBar (which is the one anchored to the UIRoot as described before)

The problem was the random UIPanel above the UIRoot, works good now! Fixed with a 768 height makes it double sized which is exactly what I wanted.
Thanks for helping me find the culprit! Much appreciated!