# Make Unity GUI for mobile phones only?

I'm using Unity and I want to make a responsive GUI for portrait resolution only. Now I'd like to know if this is a good or bad idea when I force the user to play my game in portrait mode only. Shall I use autorotate? The problem is that when you use landscape mode my GUI looks really shitty.

I have some background images and I'd like to know if I should save them for the highest resolution available in mobile devices (like tablets)? Or shall I ditch the tablets and develop the GUI with the background images for mobile phones only? TIA

## 1 Answer

It sounds like you are doing something wrong when you design your UI. Supporting only portrait, or only landscape, is not a bad thing, but supporting both is better. If you decide that your game will only support portrait mode, that's fine.

However, in the case you want to support multiple resolutions, portrait/landscape, wide screens or CRT boxes, here are some tips:

• UI elements can have a "variable" size that depends on the screen, using anchors. You can for example specify a button that its width is half of the screen's width. This means that regardless if you play on portrait or landscape, your button will resize itself to half the screen's width. This is one way to make buttons be more interactive, but it's not ideal for all cases.
• Using the above tip, you can also tick "keep aspect ratio" on images, so that they resize to the specified width/height, but the displayed image keeps it's aspect ratio. This is more likely to be used on image buttons.
• When positioning elements on the screen, do not use absolute pixels because it works on your editor. Instead, use screen portions. You want a button to animate itself and move to the middle of the screen? Then move it to Screen.width/2, Screen.height/2 (or 0.5, 0.5 if using anchors).
• Another idea which I've used on an android project in the past, is to make a different layout of your UI for portrait and landscape. Simply make a check if Screen.width is bigger than Screen.height. Having different layouts makes your game look more professional.

I hope this helps you move to the right direction. For more information, you can read Unity's tutorials: Designing UI for Multiple Resolutions and Basic Layout.

• Thank you so much for your answer. This helps a lot!:) – drpelz Dec 6 '18 at 19:30