Author Topic: UIStretch not working?  (Read 4573 times)

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
UIStretch not working?
« on: April 29, 2012, 05:08:40 PM »
Hey Aren,

I don't have a UIRoot script in game at all, however, UIStretch does not seem to correctly cover the whole screen with 1 for x and 1 for y with both horizontal and vertical selected. It covers a small amount of the screen.

Is that the correct behaviour?
« Last Edit: April 29, 2012, 05:24:28 PM by ranilian »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIStretch not working?
« Reply #1 on: April 30, 2012, 03:04:12 AM »
It should work fine without it. Keep in mind that script changes the local scale to be the screen's width/height without UIRoot.

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
Re: UIStretch not working?
« Reply #2 on: May 06, 2012, 07:03:02 PM »
Okay, I still don't get why it doesn't give it the correct scale. The only parent to this gameobject is a UIPanel with scales all 1.

Style is set to both, X = 1 and Y = 1. ScaleX = 586.6667 & ScaleY = 440.

Camera is orthographic with size: 540, clipping planes : (-500 , 500)

I have two issues here:

1) I think it should be getting the real width and real hight (not screen width and screen hight) by using screenToWorld coords.
2) It's getting the wrong scales. - Height should be 2 x ortho size.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIStretch not working?
« Reply #3 on: May 06, 2012, 07:07:03 PM »
Just write your own script if this one doesn't work for you. Look inside it to see what it does -- it's tiny.

Or you can just use UIRoot instead, and set your camera's ortho size to 1, which is how NGUI is designed to work best.