Components
Image
How to display sprites with the Image component.
The Image
component displays a Sprite
from your assets. It wraps the standard Unity UI.Image
component.
new Image {
Sprite = someSpriteFromResources,
Color = Color.red,
PreserveAspect = true
}.AsFlexItem(size: new() { x = 20, y = 20 })
Key Properties
Sprite
: TheSprite
asset to display.Color
: A color tint to apply to the image. The default iswhite
.Material
: An optionalMaterial
to use for rendering.ImageType
: The type of image rendering, e.g.,Sliced
,Tiled
,Filled
.PreserveAspect
: A boolean to maintain the sprite's original aspect ratio.