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:
ノート |
---|
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:
com.unity.vectorgraphics
package to have the UI Builder expose the ability to assign a VectorImage
as a background style on an element.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.