Author Topic: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing  (Read 9016 times)

chuk2bp

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 13
    • View Profile
UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« on: November 16, 2012, 04:59:43 PM »
Hey Guys,

Forgive me if I am missing something here-- this is a bit of a foray for me into the whole world of proper UI design and universal setups-- but after reading through and watching all your tutorials Aren I haven't been able to definitively answer a question thats been on my mind regarding Universal UI design for multiple resolutions and atlas qualities.

So, first of all, Id like to precursor the question with a few variables that are specific to what I'm doing (this may or may not completely invalidate the question, but as far as I can tell it doesnt). I have a primary nav bar at the top of the screen (designed for use in landscape) that fills the entire area.  Given the height, it only takes up 15% of the entire screen's height, agnostic of whatever the total height in pixels may be.

When provisioning atlases for this setup, it makes sense to me that based on the actual pixel height to switch these dynamically... however (and this is where my question comes in) what does NOT make sense to me, is why it would be integral to turn off automatic scaling for the UIRoot?  Why is this necessary if you can dynamically switch out Atlases purely based on the pixel height already, and (likely) use most of what is in these atlases at pixel resolution that are close to its size (so if designed at 1280x720 also using it at 1136x640)? 

To make this more clear, let say if you were viewing this UI on the galaxy S3 with a resolution of 1280x720 or on an IPhone5 with a resolution of 1136x640 from the way I see it you would want to use the exact same Atlas for both (the HD Atlas for instance).  As there are many resolutions out there that fall into the 16x9 aspect ratio it seems to me that preserving the Automatic scaling of height would make this easier to manage and to implement as a Universal UI instead of disabling automatic scaling and designing it for manual heights or changing the height dynamically through code (which, as far as I can tell, is exactly what automatic scaling is already doing).

Once again, please forgive me if my ignorance is the "true" answer to this question but I've been struggling to find the solution to this that makes logical sense and have drawn up short.  Thanks in advance to help and guidance.

And of course, thanks for NGui.  This has been a huge help in prototyping and making my game so far, very thankful for the work you've put in Aren.

chuk2bp
« Last Edit: November 16, 2012, 05:04:01 PM by chuk2bp »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #1 on: November 16, 2012, 05:18:07 PM »
Automatic setting on = your UI will always remain pixel-perfect, meaning a 40x40 sprite will always be 40 by 40 pixels, resulting it being proportionally smaller on larger screen sizes.

Automatic setting off = your UI will always remain the same size, regardless of the screen resolution. Meaning if a sprite takes 20% of your screen at 800x600, it will also take 20% of your screen at 1600x1200.

chuk2bp

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 13
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #2 on: November 16, 2012, 05:36:46 PM »
Sorry Aren, bear with me for a moment here, but then this would mean disabling the Automatic setting and then desiging a UI at...say 1280x720 (corresponding to my HD Atlas), if I were to alter the manual height to 640 (for the iphone5) dynamically during runtime that it would all scale automatically (this seems counter intuitive naming considering all things, but by its definition this is true) to the same sizing constraints?  Then, past this, at certain pixel thresholds I would just switch out to the next Atlas when those pixel dimensions are hit?

Am I understanding this correctly? This makes me a bit sick to my stomach at the moment, because up to this point I have designed my UI at 1280x720, and then attached UIStretch scripts to every single Widget to make it uniformly proportional at different resolutions. If this whole time I can simply just use manual height and have this done for me automatically then I'll plan on crying myself to sleep tonight?   
« Last Edit: November 16, 2012, 05:38:19 PM by chuk2bp »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #3 on: November 16, 2012, 05:43:25 PM »
No. If you design at 720p, keep it at that. Don't ever change the manual height value.

Manual means just that -- you will set everything up manually, and don't want the size to be adjusted automatically.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #4 on: November 16, 2012, 05:44:28 PM »
And yes, you most certainly didn't need a UIStretch script in your case. It's for automatic UIRoots.

chuk2bp

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 13
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #5 on: November 16, 2012, 05:49:58 PM »
Well then in that case, I'm back to my original confusion.  If I am manually specifying the height as 720p, (wanting this to be a universal UI) how will I allow this to be viewed on a height of 640 and have the same visual experience?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #6 on: November 16, 2012, 05:57:31 PM »
Visual experience in what sense? The UI will remain exactly the same size proportionally, regardless of screen resolution. It may be displayed across 640 screen height, but as far as its concerned it will still be using screen height of 720 pixels. All your widgets will remain proportionally the same size. 20% of screen height at 720p will still be 20% of screen height at 640p.

chuk2bp

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 13
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #7 on: November 16, 2012, 06:06:19 PM »
Hmm, I think, as I mentioned in my first post, that the real culprit here is my ignorance.   :-[ If I am (finally) understanding you correctly, then designing the UI at a height of 720p and using a corresponding atlas that has been built for the same dimensions, then disabling Automatic scaling and rendering the UI on a device with a smaller height (like the iphone5's 640p) according to Unity the resolution will still be the manually entered 720p, regardless of the screens actual height (in which case the overall scaling occurs automatically as discussed before to fit 720p into 640p via Unity)?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #8 on: November 16, 2012, 07:23:43 PM »
Right. When it's "manual", the screen height doesn't matter.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #9 on: November 18, 2012, 05:31:40 AM »
To boil it down completely:

Setting the manual height, makes UIRoot scale such that the UI will place itself as if the UI is as big as you set it, with Automatic placing a widget with localposition will always correspond directly to the screen.height.

I've made a little diagram with my awesome photoshop skills.

Do note that the aspect will remain the same on manual height, so your width in localPosition will also change with a manually set height.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #10 on: November 18, 2012, 07:34:34 AM »
Love the brackets, Nicki. Careful with those foot crayons... :D

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UIRoot Automatic Disabling for Multi Resolution, Multi Atlasing
« Reply #11 on: December 02, 2012, 10:36:48 AM »
I'm a programmer, not an artist!  ;D