Skip to content

Stretch

Jeppe Zapp edited this page Feb 13, 2014 · 3 revisions

Stretch defines the width and height of widgets relatively to screen size

Variables

Variable Type
width ScreenSize Width
widthFactor float Factor with which to multiply the width
widthOffset float Offset to modify width
height ScreenSize Height
heightFactor float Factor with which to multiply the height
heightOffset float Offset to modify height

Example

// UnityScript
var btn : OGButton;

function Start () {
   // This widget should be to the half as wide as the screen - 40 pixels
   btn.stretch.width = ScreenSize.ScreenWidth;
   btn.stretch.widthOffset = -40;
   btn.stretch.widthFactor = 0.5;
}
// C#
OGButton btn;

void Start () {
   // This widget should be to the half as wide as the screen - 40 pixels
   btn.stretch.width = ScreenSize.ScreenWidth;
   btn.stretch.widthOffset = -40;
   btn.stretch.widthFactor = 0.5;
}
Clone this wiki locally