It’s in the FAQ. The short of it is your telling your computer to place your text at a certain coordinate on your screen, however if your screen changes size the location of that coordinate changes. When your working on a GUI you need to work with percentages instead of exact numbers. You may also want to choose a more descriptive title for your post, it aids other peoples searches.
Your going to have to use a little bit of math to get it exactly where you want it. Your going to want to start by getting the screens width/height then dividing it by however far you want it over before subtracting half your texts width. It sounds a lot more complicated then it actually is, (((screenwidth/screensegments)*segmentsover)-(textwidth/2)) for example would place it in the middle of your screen width wise.
Instead of OnGUI code, you might prefer to use a GUIText object, which uses normalized viewport coordinates, so it’s always positioned the same regardless of resolution. Also, if you uncheck “pixel correct” and use the x/y scale values instead, then it will always be the same size regardless of resolution.
Thanks a lot, It was so useful. I just have one more problem
I use a GUIText and attached that to main camera but when I’ve rotate the camera the text get vanished
When you attach something to another object it becomes a child of that object and inherits any changes(I think it’s all, may want to check) made to it including transform adjustments. It’s relocating the GUI text every time you move your camera, all you need to do is detach it and the GUI text will automatically stay on the screen.
I do that too but still when I rotate and attach camera to an object I lose Text, For example I have a camera and when I play the game I’m able to see text and everything is good but when I rotate and attach camera to an object I loss text