Author Topic: Mobile screens, fixedonmobile and GUI element positions...  (Read 4633 times)

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Mobile screens, fixedonmobile and GUI element positions...
« on: December 04, 2013, 04:27:14 AM »
by using NGUI i though i have solved all my screen size problems by using FixedOnMobile.
after testing my game on galaxy S4 and some tablets and everything seems to be fine, i got slap in my face when i saw some screen shots of my game from LG g2 device. some of the NGUI element was really off screen while buttons from "easyButton" was placed just fine.

i was assuming that NGUI calculate the screen size and anchors should make sure that everything will stay where i left them more or less but i guess i was wrong?

should i use more then one anchor on nested objects (one for left and other for bottom ... for example) to make sure element will stick to place on every screen size? (is that even possible? )


Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #1 on: December 04, 2013, 10:47:59 AM »
Make sure that the minimum and maximum height on the UIRoot exceed the actual resolution of the screen. Remember if you're using fixedsizeonmobile it assumes a certain height (manual height) as the height of the screen. Try setting up your editor to use the same size on the game window, if possible, and change scaling style to FixedSize (so it assumes the same on PC/mac as on the mobile) and see what actually breaks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #2 on: December 04, 2013, 11:11:30 AM »
More than one anchor on nested objects... I'm not sure what that means. You will generally need one anchor per area of the screen you're trying to anchor to. For example a hotbar would be anchored to the bottom, while a minimap would be anchored to the top-right.

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #3 on: December 04, 2013, 01:20:52 PM »
Nicki, the LG have HD screen, means 1080px. my game is landscape mode so i need to set the height to be greater then 1080? it doesn't make sense.
now it set for 720px so if run my game on bigger screen it should be more space not less. as far as i understand.
this is UI root settings:



this how it should look (and how it look on editor - minus the upgrade items...)



and this is how it look like on LG G2 device which have HD screen:



i hope you can see the images....

ArenMook, by using two anchors i mean for example make thinks stick to bottom with one anchor and to left with another one.
the info box in the image use one anchor for for bottomleft but it still goes off screen.
what can i do to make sure every thing stay inside the screen in any resolution?
« Last Edit: December 04, 2013, 04:22:13 PM by Haim »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #4 on: December 04, 2013, 03:14:54 PM »
All the images you linked are broken.

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #5 on: December 04, 2013, 04:22:45 PM »
fixed the links...sorry.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #6 on: December 04, 2013, 05:11:04 PM »
If the info box is really underneath the anchor set to BottomLeft, then it will be anchored. Yours seems to be under a center anchor. The X distance between the info box's edge and the sun icon above doesn't change.

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #7 on: December 05, 2013, 03:26:45 AM »
well, it is set to BottomLeft, take my word on it.
but now when i look at this again it seems that all of the left side of the screen pushed off screen,not only the info box. look at the left arrow above it...
i also noted that the android bar is on the right. (in tablet it placed in the bottom of the screen)
maybe the bar push the screen away? i'm not sure... the airplane seemed centered and only the UI shifted.


 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #8 on: December 05, 2013, 03:37:56 PM »
Maybe. What I'd also do is to make the anchor run more than once (checkbox on the anchor).

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #9 on: December 06, 2013, 04:51:46 AM »
i will try this and let you know...

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Mobile screens, fixedonmobile and GUI element positions...
« Reply #10 on: December 09, 2013, 03:51:40 PM »
OK, i'm not sure what went wrong but i ended up with upgrading to 3.0.7 and completely rebuild the scene.
now it seems to work fine. the new anchors system is awesome... by the way.  8)