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 the advanced features of the Canvas and RectTransform components, such as Anchors and Scalers.
Adapting object positions
To ensure our UI adjusts correctly across different devices, let’s focus on adapting object positions using anchors.
Right now, if we play...