Resolution adaptation setting of UGUI interface in Unity

The following is my understanding of the screen adaptation scheme in Unity:
1. Scale With Screen Size scheme (automatic scaling according to the screen size)
1. If you choose the resolution adaptation scheme shown in the figure below, that is, use Canvas and Canvas If the settings in the two components of Scaler are the same as those shown in the figure below.
In addition, the UI interface you make must be mounted under the Canvas object set in the same way as in the figure below, and the created interface exists as a child object of Canvas.
insert image description here

2. This setting will be adapted according to the width of the screen, that is to say, no matter how much resolution you adjust in the Unity Game window, as shown in the figure below. The width of the game interface will also be proportionally enlarged to the resolution you set.
insert image description here
3. For example, for the following interface, I made it according to the resolution of the interface effect picture of 750 * 1334. I also set the two components of Canvas and Canvas Scaler according to the settings in Figure 1. The picture below is at 750 * The effect under 1334.
insert image description here
And I also adjusted the size of some UI materials in the interface to a fixed size, such as adjusting the width of the UI black background material in the picture below to 704px.
insert image description here
4. Now it is time to witness the release of the miracle. Now I adjust the resolution of the game to 1080 * 1920. The rendering is shown below. It can be seen that the effect of the interface has not changed much from the effect under the resolution of 750 * 1334.
insert image description here
Moreover, the width of the UI black background material in the interface is still 704px, as shown in the figure below.
insert image description here
5. Summary
The following is the answer given by AI:
insert image description here
insert image description here

insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/jianjianshini/article/details/131034560