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 and 4k) and aspect ratios (such as 16:9, 16:10, and ultra-wide), 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 object positions
- Adapting object 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 object 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 view size, we will see how...