- Home /
GUI Texture not visible
Hey,
I'm taking my first steps with the GUI-textures.This is what is did:
- I made a cube in Unity
- I deleted every Component.
- then i've added the GUItexture
- And i've selected a picture (.tiff).
But when i play the game , i can't see the GUItexture eanywhere. I have a 3d scene with camera and a cube. The camera follows the cube with " smooth Follow(script)". So that's my situation. Why can't i see the GUItexture i used?
-Thanks
Ins$$anonymous$$d of doing that stuff with a cube, simply do GameObject -> Create Other -> GUI Texture
Answer by Mike 3 · Jul 30, 2010 at 10:39 AM
Because the GUITexture needs specific x/y coordinates to show up on screen. They use 0 to 1 as viewport positioning, so if you're outside that, it won't show
If you want to show the GUITexture where the cube is, attach it to another object, and reposition it every frame from a script (using Camera.WorldToScreenPoint to get the new x/y positions)
Just to nitpick, 0 to 1 is viewport space; screen space uses pixels.
I just want to show it on screen. I used the cube because i thought i needed something to put the texture on. I could also have been a plane. But i changed the x and y position, also the left,right,bottom and top-border. But still nothing happens.
i'm trying to make a life-bar on the corner of the screen. but it still doesn't show..
You're right eric, fixed :) Cyriel - As eric says in a comment to your answer, use GameObject > Create other > GUI Texture to make your GUITexture. Set the texture on the GUITexture, then set the x and y position to around 0, 0 (for top left). You can then offset the left and top border values by half the width and height to position it perfectly
Oh Hey, it got it !! I thought i had to make an object and apply a GUI-texture to it. Yeah i know, i'm kinda learning lol. I worked right away! Thanks allot guyz ! :)
Answer by Neo 2 · Jul 31, 2010 at 09:30 AM
Check the GUITexture Transform position values.. the X Y Z values must be between 0 to 1 values to avoid any strange behaviour. I find it easy to set the X Y and Z values to 0, then on the GUITexture component's PixelInset, set the values there,, the x & y locations on the screen and the width,height of your tiff file..
Answer by Prabir · Dec 07, 2013 at 07:54 AM
Just if someone looking for a similar issue, most of the time, it can be a silly mistake like , the GUIlayer is unchecked in the Camera. So if you tried everything and still can't see the GUI Texture or Text, check if the GUILayer is unchecked in the Camera. I hope its help :)