Hi, how can i combine Input.mousePosition to GUIText.pixeloffset coords? Or, if i can’t, how can i move a GUIText to mouse position?
Thanks.
no ideas? i’ve searched everywere but no results…
is
x = input.mouseposition.x / screen.width
y = input.mouseposition.y / screen.height
guitext.pixeloffset = Vector2(x,y)
a right start?
The calculation is OK, but it is actually the X and Y values of the GUIText object’s transform.position that determines where the text will appear on the screen. You might want to look at GUI.Label as an alternative to a GUIText object.
thanks andeeee, i will work on gameobject position than…
but let me ask another (maybe stupid) question: which of GUIText or GUI.Label is the better choiche if i want to display a huge number of messages on screen with an alpha fadeout method?
thanks again.
p.s. here solved pseudocode.
Vector2 MouseCoords = Input.mousePosition;
float x = MouseCoords.x / Screen.width;
float y = MouseCoords.y / Screen.height;
Vector3 ScreenCoords = new Vector3(x, y, 0);
GUIText.transform.position = ScreenCoords;