- Home /
Help|Positing GUITexture on Center (in the middle of he screen)
how to Positing GUITexture on Center (in the middle of he screen)???
Answer by hvilela · Aug 27, 2012 at 04:56 PM
Select your image in the Project tab. Go to GameObject -> Create Other -> GUI Texture. It will be centered by default.
that not helping becuase when i'm choosing difrrent resolution, the location of the GUI Texture is changing too.
It will still in the center when you change the resolution, cause the position (transform) is relative, not pixel based (0.5, 0.5, 0). 0.5 means center of the screen, while 0 and 1 the screen extremes.
Answer by tw1st3d · Aug 29, 2012 at 05:34 PM
Alright, I've stopped being an idiot.
var background : 2DTexture;
var yourheight : int = 10;
var yourwidth : int = 10;
OnGUI(){
GUI.DrawTexture(Rect(Screen.width / 2, Screen.height / 2, yourwidth, yourheight), background);
}
This should work. I apologize for the mistakes.
i need to move he texture from the center of the screen, a little bit to the right, how to do that?
Your answer
Follow this Question
Related Questions
How to always have the mouse curser in the center of your game ? 3 Answers
Position GameObject to Bottom Left Corner 2 Answers
Anchor The Objects. 1 Answer
Move sprite depending on its collider position 1 Answer
Cursor track object 1 Answer