x


GUIText Component not showing

I have an existing GameObject, I add a GUIText component, and give it text. Nothing shows on the screen. If I create a GUIText GameObject it works fine, but it does not work when I add it as a component to an existing object. I've tried giving it a material (with Text Shader) and font, still just does not show up. Thanks!

EDIT: The Object to which I added the GUIText component is in the camera's view (very close to 0,0,0).

more ▼

asked Dec 14 '10 at 10:57 PM

spaceshooter gravatar image

spaceshooter
249 49 55 69

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

GUIText uses viewport coordinates on, i.e. 0.0 to 1.0 on x and y axes, z is used for ordering.

more ▼

answered Dec 14 '10 at 11:02 PM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

I'm not sure what you mean. What would I need to do settings wise for the GUIText to get it to show? Thanks.

Dec 14 '10 at 11:07 PM spaceshooter

Set the transform.position to somewhere between 0 and 1 on the x and y axes.

Dec 14 '10 at 11:23 PM Eric5h5

aha! I see now, thanks!

Dec 14 '10 at 11:51 PM spaceshooter

Have an addon question for you. I've gotten the text to show using the GUItextponent, but I had to use WorldToViewportPoint which ends up moving the actual object elsewhere. Is there any way I can keep the object where it is and how the GUItext?

Dec 15 '10 at 12:02 AM spaceshooter

The GUIText should be a separate object, rather than a component of an existing object.

Dec 15 '10 at 12:45 AM Eric5h5
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3694
x313

asked: Dec 14 '10 at 10:57 PM

Seen: 4563 times

Last Updated: Dec 14 '10 at 11:20 PM