UI Toolkit(1)

UI Toolkit interface

After the Unity 2021LTS version, the UI Toolkit is also built into Unity. Unity intends to make the UI Toolkit the main way to build the UI. Of course, there are still certain differences compared with UGUI. They each have their own advantages, this time we will introduce UI Toolkit
insert image description here

Open UI Builder in the following place. After that, an interface will appear
insert image description here
, which is similar to the interface we used to add and edit game objects. But the difference is that this is the editing interface of the UI.
There is another way to open it.
insert image description here
Create a UI Document file in the folder and open it to open the editing interface for direct editing.

canvas settings

Canvas Size: Used to adjust the size of the canvas.
Match game view: Checked to automatically adapt to the size of the game window
insert image description here
insert image description here
VisualElement is the base class of all UI Controls UI controls

background production

insert image description here
There are many properties of VisualElement here.
After adding the background picture, remember to change the grow in Flex to 1, so that the window with the background can be displayed. The
insert image description here
UI interface with the sky as the background is completed.

UI layout

insert image description here
Add multiple visual effect controls to the background, change the color of the background to a dark color and change the transparency and change the margin to 4%, and the above effect is obtained.
Of course you can also add other effects.

Guess you like

Origin blog.csdn.net/tongmeng_yiran/article/details/130034196