Author Topic: Everything is Scaling Too Perfectly....Wait...What?  (Read 6535 times)

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Everything is Scaling Too Perfectly....Wait...What?
« on: March 21, 2014, 02:27:39 PM »
Hello everyone, I've come across a situation where my UI is encountering some scaling issues on mobile devices (actually, everything is scaling perfectly...and that is the problem). I'm using a Fixed Size UI Root option, and all the UI elements are staying in place nicely. The problem is, on deices like an iPad, the buttons get so large they become problematic (too much distance between buttons), but on iPhones, the buttons are so small that they often miss touch input or do not activate the scripts attached to them. So:

-Is there a best practice for this type of situation? Maybe getting the device type and either scaling all UI setups for NGUI or perhaps loading different UI setups for NGUI?

-I've also noticed that on iPhone 4s, even the larger buttons often miss touch input, is this a problem with the phone itself or with my setup?

Any advice is appreciated.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Everything is Scaling Too Perfectly....Wait...What?
« Reply #1 on: March 21, 2014, 02:47:09 PM »
Fixed Size root means the UI will remain the same size proportional to the height of the screen. So if something takes 30% with one screen, it will still be 30% with another.

UI elements don't actually scale in this case -- they stay the same size, and so do colliders -- so I'm not sure what issue you're encountering.

UncleAcid

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 51
    • View Profile
Re: Everything is Scaling Too Perfectly....Wait...What?
« Reply #2 on: March 21, 2014, 02:49:15 PM »
sounds like you have incorrect pixel size settings on your atlas(s).

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: Everything is Scaling Too Perfectly....Wait...What?
« Reply #3 on: March 21, 2014, 03:01:33 PM »
@ ArenMook, perhaps I'm not using the terminology correctly. Let me put it this way:

Lets say a UI element does take 30% of the screen and in the editor that looks fine. But, when you see it on a iPad that 30% size makes to hard to use // while on a iPhone that 30% is so small it is hard to use. Is there a way to, say based on device type, change the way NGUI is drawing all of the UI elements on that device (so say that on a iPad that element changes to 15%, while on a iPhone it changes to 50%)?

Maybe I could take pictures of the UI on actual devices and post those? I'm not really sure how to explain it any better.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Everything is Scaling Too Perfectly....Wait...What?
« Reply #4 on: March 21, 2014, 04:08:07 PM »
If you want it to be based on DPI, there is a setting for that on the UIRoot. Anything more custom than that, and you'll need to write a script that will change the manualHeight of UIRoot based on your own logic.

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: Everything is Scaling Too Perfectly....Wait...What?
« Reply #5 on: March 21, 2014, 10:59:13 PM »
I see, although I don't think UI Root is the problem or solution. I suppose making different UI prefabs with different button sizes and loading them according to the device would be the best way to go about it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Everything is Scaling Too Perfectly....Wait...What?
« Reply #6 on: March 22, 2014, 02:42:27 PM »
Why would you scale 1000 widgets when you can just scale 1 UIRoot?