- Home /
GUI Screen Size
I am having real trouble with this. I want to keep the GUI text in a particular part of the screen no matter what res or screen size. At the moment every time I change PC from home to uni etc the position of the text changes. I am attempting to do thing in a 16:9 aspect ratio.
Hope someone can help??
How is this 'particular part of the screen' defined? Are you talking about a GUIText game object or the GUI system (GUI.Label())?
Answer by zombience · Oct 23, 2013 at 04:52 PM
When assigning GUIText or GUITextures to on-screen positions, use the Transform's properties (i.e. the X and Y coordinates) to position the texture on screen. These will always be screen-relative.
If you are using the pixelInset to place the textures on screen, you're going to have a bad time, since those will move according to the pixel width of your screen.
For example. you could use a pixel inset of 100 pixels from the right of the screen to place your GUITexture. On your 1920 x 1080 monitor (16:9), the pixel inset will be exactly where you want it. Then, when you bring up the project on your 1280 x 720 (also 16:9) screen, your pixel offset will still be 100, but will appear to be further in since you now have less pixels to work with on screen.
also, I currently wrote a custom editor to deal with exactly this scenario, so that I can avoid using Unity's GUI system entirely. I just work with GUITextures and GUIText as if they were normal game objects that scale relative to screen size in the editor and in gameplay. I've had this problem often enough that it drove me to drink... er, i mean.. fix the problem
After I'm through with the current project, if I get some time I'll put up a package on the Asset store.
Your answer
Follow this Question
Related Questions
can i find Joystick Position based on screen size? 0 Answers
GUI crashes in Android 4.1 0 Answers
Display text on each side of cube 0 Answers
[solved] Problem getting data from array 0 Answers
Is there way to apply scale on guitext? 0 Answers