Author Topic: wrong manual height - device height  (Read 4315 times)

concave

  • Guest
wrong manual height - device height
« on: July 01, 2013, 09:41:38 AM »
i build a nGUI at Iphone5 Resolution, ar: 16:9 ... height - 1136px. if i try to set the manual height to change to f.g. 600: 1024 (~16:9) resolution
the value that makes the gui fit the screen is a lot different than 1024. The UnityGameScreen is fully scaled (over 1024 height) What could be the problem?
 

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: wrong manual height - device height
« Reply #1 on: July 01, 2013, 06:56:05 PM »
Are you building to the phone or doing it in the editor? If editor, then make sure your window is big enough to contain the full resolution - see the "stats" button on the game window to see the real size there.

Otherwise, check the Maximum height on UIRoot - it should be more that 1024. In an older version, if you exceeded the max size, it defaulted to potato - so nothing made sense. If you're using the free version, you might be so lucky.

concave

  • Guest
Re: wrong manual height - device height
« Reply #2 on: July 10, 2013, 12:26:05 PM »
first of all, thx for your answer!!!

1. i was aware of the editor size issue.
2. hmm i am using pro version - and when i take a look at the root script the max height has nothing to do with the manual height because of a logicalswitch between pixelperfect and fixedsize.

does someone know how and where the factor for scaling is being calculated? Where do the refering values come from ? Does the algo use the smallest rectangle enclosing all ui elements?

kind regards,
oliver

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: wrong manual height - device height
« Reply #3 on: July 10, 2013, 01:01:44 PM »
Assuming you are talking about what I think you're talking about -- UIRoot is what scales itself based on screen height.

concave

  • Guest
Re: wrong manual height - device height
« Reply #4 on: July 11, 2013, 08:18:24 AM »
my greatest problem is that i don't get why UI on fixedsize -
MANUAL HEIGHT value DOESN'T FIT in the DEVICE (or the gameview preview)

when i check the code of the root - its doing nothing more then scaling the GO - by the height of the screen.
mTrans.localScale - scales relativ to the parent - the uiroot is the highest hierachy object in the scene.

   void Update ()
   {
      if (mTrans != null)
      {
         float calcActiveHeight = activeHeight;

         if (calcActiveHeight > 0f )
         {
            float size = 2f / calcActiveHeight;
            
            Vector3 ls = mTrans.localScale;
   
            if (!(Mathf.Abs(ls.x - size) <= float.Epsilon) ||
               !(Mathf.Abs(ls.y - size) <= float.Epsilon) ||
               !(Mathf.Abs(ls.z - size) <= float.Epsilon))
            {
               mTrans.localScale = new Vector3(size, size, size);
            }
         }
      }
   }

if my active Height is 800 the UIRoot will be scaled  -> mTrans.localScale = new Vector3(0.0025,0.0025, 0.0025);

and that doesn't fit in height or width - if i use 950 it works. the camera settings are as default.

-> i have to use a bigger hight value - scale it to a smaller size - to fit it into height and width.

i am using draggable panels - and some of them have many items so the panel bounding is a lot higher then the device - can this cause the problem?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: wrong manual height - device height
« Reply #5 on: July 11, 2013, 07:34:47 PM »
Huh? Doesn't fit where? If your device is 1920x1080, and you set manual height to 1080, then build for landscape mode, then it will be the same as leaving it on pixel-perfect. As long as you didn't change the orthographic size of the camera (which is by default at '1'), it works out of the box.