Answers for "GUI Styles for iPhone/Android - font/button sizing?" The latest answers for the question "GUI Styles for iPhone/Android - font/button sizing?" Answer by Herman-Tulleken <p>There are, I guess, several solutions to the problem depending on how you implemented your GUI. It is a nasty problem, and the solution is not pretty.</p> <p>Here is what we did: (we only use resolution based on <code>Screen.width</code> and <code>Screen.height</code>, but it should be easy to incorporate device checks using AppTechStudios's method to take the real size into account as well).</p> <p>Since there are no dynamic font scaling on mobile devices, you need to import a few different size fonts for each one you want to use. (We import three sizes of each font). For this reason, it is a good idea to limit the number of fonts you use, otherwise it becomes a real nightmare to maintain.</p> <p>All our styles are in a single class. When this class Starts, we check what font is used for each style (for instance, <code>button_label_font_1</code>), based on the resolution, we then change this to <code>botton_label_font_2</code>, or <code>botton_label_font_3</code>, or keep it the same. </p> <p>If you use relative layouts everywhere, that is fine. If you use absolute layouts, then you have to recompute sizes. We store <code>Screen.width / 800</code> in a globally accessible variable, and scale all our GUI sizes by it. <code>800</code> is the size we designed for; our base size. You can also store and use <code>Screen.height / 600</code> (where <code>600</code> is the base height), and use that scale for heights, but this changes the aspect ratios of rectangles (buttons) which may be a problem (it is for us).</p> <p>If you don't skin the GUI with components with borders, then that's fine. Otherwise you might need to change those as well (thick borders look awful on low resolution devices).</p> <p>In addition to standard GUI components for menus, we also use a combination of <code>GuiText</code>s, <code>GuiTexture</code>s and rendered planes for the in-game GUI (the standard GUI is a real performance hog on mobile devices). These need to be positioned using calculations based on the scale variable(s) as explained above.</p> <p>If your GUI is even moderately complicated, be prepared for a lot of annoying tweaking, and test various sizes regularly to avoid surprise. </p> <p>Good luck :)</p> Fri, 21 Jan 2011 22:25:09 GMT Herman-Tulleken Answer by AppTechStudios <p>I am not sure about changing the font and stuff, but I know you can access what device is being used. For example, the iPad:</p> <pre><code>if(iPhoneSettings.model == "iPad") { </code></pre> Thu, 20 Jan 2011 03:24:16 GMT AppTechStudios Answer by tertle <p>I don't program for mobile devices, but couldn't you just scale your buttons up relative to the resolution of the screen the device is on using Screen.currentResolution?</p> <p>ie. if you had 4 evenly sized buttons each would be 4 / Screen.currentResolution.Width (or height depending where your buttons are)</p> <p>Personally I always use images for buttons rather than game rendered text so scaling is easy. But if you needed to scale up text, just a quick lookup table based off currentResolution is probably easiest method.</p> Thu, 20 Jan 2011 02:52:45 GMT tertle