- Home /
How can i control a GUI Texture?
How can i control a GUI Texture Position?
There should always be in the upper left corner, no matter what size has the browser window.
thanks
Answer by Lipis · Mar 08, 2010 at 02:05 PM
Let's say you created a GUI Texture
from the menu (GameObject->Create Other->GUI Texture
).
This will create a UnityWatermark-small
texture on the center of your screen. In order to change the position and put it in the upper left corner, you have to do 2 things, but first select the object and in the Inspector:
- Change the
Transform.Position
to(0, 1, 0)
- From the
GUITexture
component change thePixel Inset
to:X = 0
Y = -58
And you will get what you want.
Just remember that no matter how big is the resolution of your game is, the (0, 0, 0)
position of your GUITexture
is the lower left corner, (1, 1, 0)
is the upper right corner and the Z value is used if you have overlapping textures.
As for the Pixel Inset (directly taken from Unity's Manual):
The purpose of the Pixel Inset is to prevent textures from scaling with screen resolution, and keeping thim in a fixed pixel size. This allows you to render a texture without any scaling. This means that players who run your game in higher resolutions will see your textures in smaller areas of the screen, allowing them to have more screen real-estate for your gameplay graphics.
More details can be found in Reference Manual for GUI Texture
.
To clarify, the required Inset is X=0, Y=-(texture height), Width=texture width, Height=texture height.
And if you want a fullscreen GUI texture, set position to (0.5, 0.5, 0), scale to (1,1,0) and all the insets to 0.
Answer by flashtech · Mar 08, 2010 at 02:54 PM
If i use this:
- Change the Transform.Position to (0, 1, 0)
- From the GUITexture component change the Pixel Inset to: X = 0 Y = -58
is on lower left corner, not the the upper left corner! are you sure? this is the richt dimensions?
well yes.. I'm absolutely sure..!! BUT please stop posting new questions as answers.. and it would be better to delete them..!! Just play with Transform.Position values and check the result.. set it to (0, 0, 0) maybe you mean lower when you are saying upper.. I have no idea..! :)
Answer by flashtech · Mar 08, 2010 at 02:24 PM
Good! but where can I find the (option) Transform.Position?
Please use add comments ins$$anonymous$$d of answering...!! :)