Hi, so long time since i went near coding.
I’m just trying to make a simple GUI box that display the vectors of my object.
function Start()
var xPosition : float;
var yPosition : float;
var zPosition : float;
}
function Update () {
xPosition = transform.position.x;
yPosition = transform.position.y;
zPosition = transform.position.z;
}
function OnGUI(){
GUI.Box(Rect(5,5,240,300)"X : " xPosition "
Y : " yPosition "
Z : " zPosition);
}
The
is for starting on a new line.
So anyone got an idea what could be the problem ?
~Wentzel
You have the formatting of that string a bit awry - the fastest way to get you want is just to use this:
function OnGUI(){
GUI.Box(Rect(5,5,200,30), transform.position.ToString());
}
Your existing format string needs a comma before it then:
"X : " + xPosition.ToString() + "
Y : " + yPosition.ToString() + "
Z: " + zPosition.ToString()
Appreciate the help @ Mike (whydoidoit)
Just two more questions,
How can display the frames per seconds also ?
Is there some way i can move the text to the left of the Box ?