Author Topic: Scaling to screen size?  (Read 4321 times)

Sephiroth73003

  • Guest
Scaling to screen size?
« on: July 31, 2012, 05:07:51 PM »
So my current project UI is coming along fine, but I have the camera at the current target resolution and am trying specify all sizes of objects as a function of screen size for when I begin work on different resolutions.

Thing is when I call Screen.width I am only getting the current game screen width in the editor so it doesn't lineup with coordinate system I am using for the camera. (IE camera is set to 1280x720 through UIRoot but the Game editor is some other smaller 16:9 system). I know NGUI calculates relative sizes but I can't seem to directly set them myself (read only). How do I get access to the current camera bounds since pixelHeight/pixelWidth also just return the Screen sizes in the editor.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scaling to screen size?
« Reply #1 on: July 31, 2012, 10:24:46 PM »
Uncheck the "automatic" checkbox on UIRoot, and then you will be able to set the size manually.

JRoch

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
Re: Scaling to screen size?
« Reply #2 on: August 01, 2012, 12:58:30 AM »
Also, take a look at the pixelWidth and pixelHeight properties of the Camera object for your main camera.  ScreenWidth and ScreenHeight aren't always relevant if your app is running in windowed mode.