- Home /
Changing an objects transform position
I'm trying to change the transform position of some GUI text called FPSCount
, is there a script I need to add to make it (0,1,0)?
I've tried
var position: FPSCount;
transform.position = FPSCount(0, 1, 0);
Comment
Best Answer
Answer by aldonaletto · Dec 07, 2013 at 08:01 PM
transform.position has a different meaning for GUIText (and GUITexture): X and Y are in viewport coordinates, which range from 0 to 1, and Z tells the depth relative to other GUI elements. If you want to move the GUIText by script, just set its position directly (script attached to the GUIText):
transform.position = Vector3(0, 0.7, 0);
Notice that Y=1 will place the GUIText above the screen top.