Hello All,
I’m sure this has been covered here somewhere, but I just can’t seem to find it.
Can someone show the best practices for using GUITextures and GUITexts with the different IPhone/IPad/Ipod resolutions etc? I am having trouble finding the best way to align the GUITextures on the screen so they show up on the same spot and the ~same relative size on different IOS devices. I’m using an IPod touch 4th gen for hardware but test in the older low res and IPad 4x3 res.
Once more, even if I can figure out how to properly size/place the texture, how do you align the guitext on the texture properly?
I’m sure folks have this solved already, mind sharing?
I design everything in 960x640 (or in 1024x768 respectively, please read on).
For stuff that covers the whole screen (splash screens etc.), I keep it 1024x768 with “disposable” margins, not visible when you set the player resolution to 960x640.
For stuff that can remain center-locked (absolute)
Transforms: 0.5, 0.5
Pixel inset values: Modifying them for the desired placement
For stuff that should be edge-locked (relative) - HUDs, counters etc.
Transforms: Modifying them for the desired placement
Pixel inset values: Not touching those
For 480x320 devices, there is a global script multiplying pixel inset values by 0.5 and replacing textures with their half-res versions (optional, you can use original versions).
For GUI texts, it should be pretty much similar, for 480x320 you of course need half-sized fonts.
I don’t know if this approach is the best one, but it works for me.
Thanks for replying!
That sounds fairly straight forward. Can you elaborate a little on your global script? What does that look like and how are you running it?
You could consider ditching use of GUI texts and work in the world coordinates of your camera. This way the positions and sizes are relative and not absolute, which leads to problems with different resolutions. See some example images here: “What is the problem?”.
If you switch to working in the world coordinates, then you can’t use GUI Text, but instead some other text way. For example, the built-in Text Mesh can be one alternative. However, like also depicted in the link above, with the TextMesh you have the issue that if you tune the character size for one certain dpi / screen resolution, it can look either jaggy or blurry in another configuration.
My Dynamic Text in Asset Store tries to be an solution for that problem. That is, you use it like Text Mesh but it’s sharp like GUIText.