Version: 2021.2
言語: 日本語
Positioning elements
Styling text

Setting background images

UI builder doesn’t have a dedicated “image” element. To create an image in UI Builder, create a regular VisualElement and set its Background > Image to the desired image. The image below displays a preview of the background style properties in the Inspector:

BackgroundStyleProperties
BackgroundStyleProperties
ノート
Avoid using the Slice background style properties. You can use Slice to set up 9-slicing on an image. however, it’s specific to the element and not the image. Use the existing 9-slicing support in the 2D Sprite Editor and 2D Sprite assets. See point (2) below.

By default, any regular texture image works in UI Builder. You can add support for additional asset types by installing some optional packages:

  1. Install the com.unity.vectorgraphics package to have the UI Builder expose the ability to assign a VectorImage as a background style on an element.
  2. Install the com.unity.2d.sprite package to have the UI Builder expose the ability to assign a 2D Sprite asset (or sub-asset) as a background style on an element. With the 2D Sprite package installed, you will also have the ability to open the 2D Sprite Editor directly from the Inspector.
Positioning elements
Styling text