- Home /
GUI System on multiple resolutions
I am currently developing for apple products, and as far as I know they have 3 different resolutions(3g, 4, ipad)
What sort of formula do I need so the elements will always show up in the correct spot? In the future I hope this solution would apply to the many different android resolutions too.
Answer by J3-Gaming · Jul 15, 2011 at 09:30 PM
My solution i used was a percent based GUI. I can set an x/y value in the inspector such as 50,75
It will then position the element at x: 50% screen space, y: 75% screen space, it is pretty accurate
Yes, this is it. Screen.width*0.5 will always be 50% of the width. GUILayout also helps.
Answer by Waz · Jul 15, 2011 at 09:26 PM
There is no magic formula to deal with different aspect ratios. You have to write your game to adapt to the Screen.width and Screen.height in whatever way makes sense for your game. You may just add black bars above and below or left and right, but that is poor use of screenspace; you may make the view wider on wider aspect ratios, but that may reveal too much of a scene; you may make the view taller on non-wide screens, but that reveals more in a different way. You may squish or stretch, put the your circles will look like ovals. Also, some displays have physically chunkier pixels (iPad vs iphone4) - you may need to change button sizes to keep them finger-sized - similarly for mouse vs finger UIs.