Author Topic: Question on "Flexible" vs "Constrained" UI Root Types  (Read 2861 times)

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Question on "Flexible" vs "Constrained" UI Root Types
« on: December 23, 2014, 07:29:19 AM »
Hello everyone, I'm sorry I even need to ask this, but I'm just not getting it:

I've always thought that I understood "Flexible" vs "Constrained" UI Root Types. Flexible makes Widgets stay the same size in pixels regardless of resolution (so a 100x100 widget would be relatively large on a screen of say 480x320 and quite small on say 2048 x 1536, while Constrained makes the Widget into a % of the screen based on parameters, so the Widget will occupy the same screen space at both example resolutions.

However, I was trying out Flexible today and noticed that no matter what I did, a 100x100 Widget seemed identical on low resolution screens as high resolution screens inside the editor. I thought that perhaps my physical monitor resolution was perhaps obscuring my results, so I tried the lowest resolution I had and the widget actually got smaller....what? I also tried changing the window size in the Editor, same results.  So I guess I don't understand Flexible at all, seeing as the widget remained the same size regardless of screen resolution differential.

Any clarification is appreciated.
« Last Edit: December 23, 2014, 07:45:14 AM by blitzer »

r.pedra

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 20
  • Posts: 131
    • View Profile
Re: Question on "Flexible" vs "Constrained" UI Root Types
« Reply #1 on: December 23, 2014, 09:03:41 AM »
What did you specify for Constrained parameters? (Width and Height, and which one you choosed to constrain)

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: Question on "Flexible" vs "Constrained" UI Root Types
« Reply #2 on: December 23, 2014, 11:13:50 PM »
@r.pedra: (thanks for responding)

What did you specify for Constrained parameters?
->I don't quite understand the question (sorry), the Constrained UI Root type works exactly as I expected, its the Flexible option I'm not understanding. For Flexible (to test in the most simply way possible), I just put a 100x100 widget with a sprite in it and tried different resolutions and noticed that the widget seems to scale with the resolution (which I thought was not supposed to happen under Flexible). I attached  new example picture showing the UI Widget (which has no anchors) with 2 different resolutions and editor window sizes, and the UI Widget still seems to occupy the same amount of screen space even under Flexible.

r.pedra

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 20
  • Posts: 131
    • View Profile
Re: Question on "Flexible" vs "Constrained" UI Root Types
« Reply #3 on: December 24, 2014, 05:04:20 AM »
Set your minimum height to 0. UIRoot is caping your height with the minimum height specified and when your screen is under X pixels of height, NGUI tries to keep the height of your game at X pixels

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: Question on "Flexible" vs "Constrained" UI Root Types
« Reply #4 on: December 27, 2014, 01:38:44 AM »
Right on the money, thank you!