GUIText not working.

GUIText is not working for me, at all.
I have a scene with 1 camera, it doesn’t have a parent.
I have the GUI Layer YES.
When I add GUIText and enter text it just doesn’t show up.

I tried:
Deleting EVERYTHING on the scene, except the camera. Still doesn’t work.
Using a new camera.

IT DOES work if I start a new project, and add GUIText to the camera.

So, is there a setting I could have changed in this project?

I appreciate any help. I am so confused why this just isn’t working.

GUIText and GUITexture use viewport coordinates. If the x or y coordinates are outside the 0…1 range they won’t be visible.

–Eric

2 Likes

Eric,

I don’t see anything different anywhere on this project compared to a new project. It has to be a setting somewhere that is making the GUIText not render.

You really shouldn’t have the GUIText component on a camera. It should be a separate object.

–Eric

Even though it works on the camera on a new project I still tried your advice, no luck. I took it off the camera, and placed it on another object to no avail. It just wont work in this project for some reason. I can delete EVERYTHING from the project and start new and it still wont work. Something got changed in the project. Some setting, which I would LOVE to know what so I can not have to scratch an entire scene that was 99% complete. If some setting didn’t get changed, it has to be a bug.

You can always export the scene as a package and import it into another project.

–Eric

New update.

  1. Changing the GUIText Y to 650 put’s it roughly in the right spot… why though? (Screenshot included)
  2. EVEN if I export the scene and import it into a new project the problem still happens. There are 0 problems with
    using a new scene / project. Just some problem with this scene.

As I said, GUIText/GUITextures use viewport space. That means you can’t make them children of the camera, which uses world space. There’s no reason to, either. Just make them separate objects.

–Eric

I filed a bug report for this behavior now. My GUIText isn’t showing and I can only relate it to me accidentally deleting Main Camera from my scene and then creating a new camera object. Regardless of what I do I can’t get the GUIText to appear (adding it to another object or the camera itself).

You can recreate this problem:

  1. Create a new scene
  2. Delete Main Camera
  3. Create a new Camera (GameObject > Create Other > Camera)
  4. Add GUIText to the camera and enter a test text… nothing appears?

That’s a waste of everyone’s time, since there isn’t a bug. Please do what I said and make the GUIText a separate object. It should not be a child of the camera, it should not be a component on the camera. It must be a totally separate independent object because it uses viewport space, not world space. It works 100% correctly: GameObject > Create Other > GUIText. Do not move it away from the 0…1 range in x/y or it won’t be visible.

–Eric

1 Like

I miss understood your previous post because I created a separate gameobject that I then added GUIText to (I incorrectly didn’t make it an entirely own object.)

UPDATE: Doh, and of course you can have it as a separage gameobject only it wasn’t in view because of the way the Y-coordinate works… 0,0,0 puts it out of view so 0,1,0 puts it in the right place - that’s why it didn’t work for me.

Sorry for taking up unnecessary time.

I have done all the above and I still cant see a freakin thing in Unity 4.

AAAARRRGGGHHHH
:slight_smile:

Don’t look at the scene view, look at the game view.

–Eric

3 Likes

is the GUI layer checked on the checkbox on your camera?
I just solved this same issue for myself by just checking that box.

Look under Pixel Offest you will see an x and y coordinate value. Change each of the values to 1 and the GUI Text will be displayed.

Hello,
try this.

make sure your GUI Text position is at X 0.5 Y 0.5 Z 0
(this is the default value in world space)

if you have moved this object it shall not be displayed in the correct location on screen.
make sure the GUI text is an object on its own and not parented to the camera.
(it does not matter where your camera is positioned in world space as the two are not linked directly)

if you have moved the GUI text, open up the transforms tab and make sure your position is set to the default values above.
(Transforms tab on GUI Text is closed by default - click the arrow to open it up)

Enjoy!

4 Likes

But the GUI Text should have be in scene view too, Eric.

FWIW: This is the default if you use the ‘Create’ menu in the ‘Hierarchy’.

If you just create a new Game Object, and the GUIText as a component, the position can be anywhere.

Ideally the script itself would handle this possibility through OnValidate or something.

I haven’t used GUIText in a while, and had to search out why it wasn’t showing up either…

I have a similar issue.

When I create a GUIText object, the default font is Arial and everything works ok.
As soon as I change the font, the text disappears.
To make things more silly, while in play mode (paused) i edit the font itself (change char size) the text appears but as soon as i hit “unpause” the text disappears. Its VERY strange, because it works in my other project.

The GUIText object is a part of my GuiManager object which shows messages and stuff. This GuiManager was exported as a package from another project where everything works.

I have realized it’s not working when I was doing a tutorial level where the messages usually show up. Still don’t have a solution. I will just use Arial :stuck_out_tongue:

I’ve started using GUI Text and I am having similar problems, but it seems as though the answer may be as simple as “use 3D Text instead”. So am I correct in saying that the only way to position a GUI Text is to use the pixel offset? This means that the location of the text will appear in a different location on the screen based on the resolution of the device, unless you set up an algorithm to determine what you want your pixel offset to be based on the resolution of the current device.

3D Text seems to avoid these issues by using the world space, or ‘unity units’, to set the location of the text. I guess it could be determined on a case-by-case basis but with Unity’s cameras I’d be surprised to find a reason to use the GUI Text.