Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: hariprasad787 on November 21, 2012, 01:46:15 AM

Title: nGUI elements placement problem, portrait mode in iPad
Post by: hariprasad787 on November 21, 2012, 01:46:15 AM
Hello,

I am using nGUI Version 2.2.3.

The placement of the buttons is not appearing properly in the ipad device (portrait mode).
However the same appears properly in the editor.Am I missing something or am I doing
something wrong?.

This problem doesn't seem to appear in landscape mode, both in editor and device.
Please find the attachments for the reference.

Kindly someone guide me in this regard.

Thanks,
Hari


Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: ArenMook on November 21, 2012, 01:52:03 AM
Did you use 2 different anchors there? One anchor on the bottom left button, anchored to bottom left, and another anchor on the bottom right button, anchored to bottom right? You should.

You also should update to 2.2.6.
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: hariprasad787 on November 21, 2012, 01:59:41 AM
Hello ArenMook,

I have not changed the pivot point. I just created the buttons and assigned them the sprites. For both the buttons the pivot is at the center itself.
I ran the same scene in landscape mode. This problem was not there. Is there any other thing that I am missing?

Sure I will update to 2.2.6.

Thanks,
Hari
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: ArenMook on November 21, 2012, 02:03:08 AM
So they're both anchored to the center, and are in essence positioned in fixed places on the screen. When your screen size changes, they appear to "move" -- while in fact they stay in the same spot, it's your screen size that moves.

You need to use anchors correctly. Check the first example. Build it for iPad. See how it changes and note how the buttons stay in corners. Tilt the iPad. Watch how the center-aligned dialog box now gets cut off, but the buttons still remain in the corners.
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: hariprasad787 on November 21, 2012, 02:17:03 AM
In my game I am supporting only the portrait mode(only Portrait Upside Down no rotation). 768x1024. Screen size never changes.

In the other game also I am using nGUI only in Landscape mode. This placement problem is not happening in that.


Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: ArenMook on November 21, 2012, 02:22:53 AM
Look at the size of the pictures you attached. iPad is indeed 768x1024, but the editor picture is 768x950.

Your game window size in the editor doesn't match your iPad size.
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: hariprasad787 on November 21, 2012, 02:43:30 AM
For your reference,

ipad_portrait_mode.jpg (768x1024) is directly taken from the device(iPad3 specifically).

unity3d_editor.jpg  (768x950) is taken manually from the unity editor (mac specifically using cmd+shift+4).

Images that I have attached are for the reference. Please do ignore the the size.
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: hariprasad787 on November 21, 2012, 02:48:43 AM
I have attached the other image for reference. please have a look at that.
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: Nicki on November 21, 2012, 03:05:11 AM
What's your UIRoot settings?
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: Nicki on November 21, 2012, 03:08:40 AM
Derp derp, just saw your picture. :)

I'm not sure what's going on. Try using an anchor per button and anchor them to bottomleft and bottomright instead of center?
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: hariprasad787 on November 21, 2012, 06:34:23 AM
Hello Nicki,

I tried that. Still that issue is there.
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: ArenMook on November 21, 2012, 05:45:33 PM
No idea what you're doing wrong either. Check the transforms leading up to your buttons and make sure they all have scales of (1, 1, 1).
Title: Re: nGUI elements placement problem, portrait mode in iPad
Post by: hariprasad787 on November 21, 2012, 09:19:44 PM
Thanks for the suggestions.