Creating a responsive UI
Nowadays, it is almost impossible to design a UI in a single resolution, and our target audience display devices can vary a lot. A PC has a variety of different kinds of monitors with different resolutions (such as 1080p, 4k, and so on) and aspect ratios (such as 16:9, 16:10, ultra-wide, and so one), and the same goes for mobile devices. We need to prepare our UI to adapt to the most common displays, and Unity UI has the tools needed to do so.
In this section, we will explore the following UI responsiveness concepts:
- Adapting objects' positions
- Adapting objects' sizes
We are going to explore how the UI elements can adapt their position and size to different screen sizes using advanced features of the Canvas and RectTransform components, such as Anchors and Scalers.
Adapting objects' positions
Right now, if we play our game, we will see how the UI fits nicely onto our screen. But if for some reason we change the Game...