Author Topic: Best way to support multiple resolutions  (Read 17572 times)

joelsantos

  • Guest
Best way to support multiple resolutions
« on: April 12, 2012, 04:08:07 AM »
Hi there.
I have a game on the Google Play Store (Shameless self promotion ftw  :D ) that as all its UI done by hand with the unity gui system.
I have bought NGUI and I am trying to learn and I am having some doubts.
Is there an easy way to maintain the same aspect ratio on resolution change? I could easily do this in the GUI system using the GUI.Matrix option... But I'm not being able to do it in NGUI. In the Y Axis it seems to work fine if I set the camera to manual... But in the X-Axis in can't maintain the same aspect...
I am not interested in pixel perfect for the moment.. I was just wishing that I could work in one resolution and it would work as expected for every other one.
Any help?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best way to support multiple resolutions
« Reply #1 on: April 12, 2012, 04:20:16 AM »
If you set UIRoot to "manual", it will keep the height you specify regardless of resolution changes. Aspect ratio changes simply let you see more or less on the left and right sides of the screen. You can glue widgets (and groups of widgets) to corners and sides of the screen by using UIAnchor. I'd suggest you take advantage of that instead of squishing / stretching your UI with the aspect ratio changes, which looks hideous when going from a 4:3 iPad to a 16:9 monitor. :)

joelsantos

  • Guest
Re: Best way to support multiple resolutions
« Reply #2 on: April 12, 2012, 04:25:52 AM »
Thanks for the quick response.
I see. I've been playing with the tutorials and trying to learn, but I'll give the Anchor documentation a full read and will try to use it then.
Thanks for your time  ;D You are amazing

PapaWhiskey

  • Guest
Re: Best way to support multiple resolutions
« Reply #3 on: December 22, 2012, 01:11:58 PM »
aspect ratio changes dont just show or hide more or less of an object..

consider a circle...if you dont maintain aspect ratio while scaling, you end up with an oval, or anything non circular when you change resolutions.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Best way to support multiple resolutions
« Reply #4 on: December 22, 2012, 09:09:39 PM »
When you change aspect, either height or width changes. NGUI is based on height, so your circle will "fit" on the height size, if you leave the UIRoot on automatic, but it will either cut off or make space around the circle. It will not scale it so that the widget changes its aspect, it's the screen that changes aspect.