GUITexture issue

I've created prefabs that are just GUITextures (6 of them). I created an empty game object prefab, named "HUD", that has a script to hold the 6 GUITexture prefabs and position them. All of the GUITexture prefabs have been assigned a texture and a width and height only. The X/Y values are 0 and the Borders are all 0.

First, will this even work? If so, I can't figure out how to get the GUITextures to even appear on the screen. I've been reading and people keep saying to set the transforms to zero and use GUITextureName.pixelInset to place the GUITexture where you want. This doesn't seem to work. Maybe I just don't understand how to position something like this in viewport space?

I don't see why you shouldn't be able to have multiple GUITextures in one empty game object and just control where they appear from the script.

Any help would be appreciated! Thanks!

  • Austin

Hello,

To render a GUITexture on the screen you will need to make sure of the following :

  • The scale from the transform must be set to 0
  • The texture is on a layer that is drawn by the camera
  • The width and height of the GUITexture are bigger then 0

If you want to draw a GUITexture on the screen do the following steps :

  • Create an empty gameobject

  • Set all of it’s transform values to 0

  • Add a GUITexture component to it

  • Drag and drop the texture you want displayed on the GUITexture in the Inspector

  • Toy around with X , Y , width and height until you get the desired results