-
Notifications
You must be signed in to change notification settings - Fork 25
Anchor
Jeppe Zapp edited this page Feb 13, 2014
·
2 revisions
Anchors fix widgets to a particular place on the screen
Variable | Type | |
---|---|---|
x | RelativeX |
Position on the x-axis |
xOffset | float |
Offset to modify position on the x-axis |
y | RelativeY |
Position on the y-axis |
yOffset | float |
Offset to modify position on the y-axis |
// UnityScript
var btn : OGButton;
function Start () {
// This widget should be to the left, centered vertically, with a 20 pixel offset
btn.anchor.x = RelativeX.Left;
btn.anchor.xOffset = 20;
btn.anchor.y = RelativeY.Center;
}
// C#
OGButton btn;
void Start () {
// This widget should be to the left, centered vertically, with a 20 pixel offset
btn.anchor.x = RelativeX.Left;
btn.anchor.xOffset = 20;
btn.anchor.y = RelativeY.Center;
}