system
1
Simple enough, I am trying to add a GUIText element to my scene with a fixed position on the top-left corner.
I found this related post here for positioning, but when I use that code in a js script attached to the GUIText element I am getting a nice:
BCE0019: 'position' is not a member of 'UnityEngine.GUIText'.
Any help appreciated!
Waz
2
As SilverTabby suggests (transform.position), or guiText.pixelOffset, depending what you mean by “fixed position”.
system
3
If you just need uneditable text, you can use:
function OnGUI () {
GUI.Label (Rect (10, 10, 100, 20), “Your text here”);
}
The numbers are the X and Y coordinates of the upper left corner of the text box followed the X and y size of the box.
Or if the text needs to be edited:
var stringToEdit : String = “Your text to edit here”;
function OnGUI () {
stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
}
The 25 is the maximum length to edit.