Version: 2021.2
Create and manage UI Documents (UXML)
Runtime UI vs Editor Extension Authoring

Set up the Canvas

Canvas
Canvas

Within the Viewport pane, you can find the Canvas, a floating re-sizable edit-time container that contains a live version of the UI Document (UXML). If you can’t see it, select the Fit Canvas button in the Viewport toolbar to bring it into view. Any settings related to the Canvas, like its size, aren’t saved as part of the UI Document (UXML) but stored in a separate settings file for the next time you open the same UI Document (UXML).

Size the Canvas

To resize the Canvas inside the Viewport, drag the edges or corners. For exact sizing, click on the header of the Canvas through the Inspector pane, where you will see fields for Canvas height and width. You can also lock the Canvas size to the size of the Unity Game Window using the Match Game View checkbox to align with a runtime UI environment:

CanvasSizeSettings
CanvasSizeSettings

Change Canvas background

You can change the Canvas background to make editing the UI in context easier. To change the background, select the Canvas in the Inspector pane. You can set it to be a solid color, a specific texture (a mock up from a UI Designer), or a live view from a Camera in an open Unity Scene:

CanvasBackgroundSettings
CanvasBackgroundSettings
Create and manage UI Documents (UXML)
Runtime UI vs Editor Extension Authoring
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961