- Home /
How to give a relative position to a GUI Texture ?
Hi,
I'm currently trying to make my game's HUD with GUI Textures and GUI Text.
I have a GUI Texture with the HUD's design, and 3 GUI Text giving pieces of information about the player's state. Quite classic and simple.
First of all, is it right to do it this way ?
I completed the official 3d Platform Tutorial in which a GUI Skin is used, but i thought (and still think) that it's much too complicated for what I want to do.
If it is, how can I give a relative position (depending on width/length of the screen) to my GUI Texture and my GUI Text ?
Thanks!
Answer by Eric5h5 · May 30, 2010 at 09:28 PM
GUITexture and GUIText objects (as opposed to code in OnGUI functions) use viewport space. This means that (0,0) for the X,Y coordinates is always the lower-left corner of the screen, and (1,1) is always the upper-right corner, no matter what the resolution is.
I just tried it out and my HUD fits to the screen, no matter the resolution (as you said). Thank you!