Documentation

Unity Spark

Open Unity Spark

Unity Spark

Text, images, icons, and shapes

Show words, pictures, ready-made symbols, and styled panels in your Unity Spark UI with the Text, Image, Icon, and Shape elements.
Read time 3 minutesLast updated 3 hours ago

Use text, images, icons, and shapes to show information and to frame the rest of your UI. For what each element is for, refer to Choose an element.

Text

A Text element shows words on the screen, such as a title or a score. A new Text element shows
New Text
, and its size changes automatically to fit its box.
Give each Text element a style role, such as Title, Heading, Body, or Caption, so it uses your UI style's fonts. A Text element with no role uses a plain default font.

Text properties

The Text component contains the following main settings.

Setting

Description

Font and StyleSets the font, and whether the text is bold or italic.
TextSets the words to show.
Horizontal Align and Vertical AlignSets how the text lines up inside its box.
SizeSets the text size. When Auto-Size is enabled, set Min Size and Max Size instead.
Auto-SizeShrinks the text to fit its box.
ColorSets the text color.
Wrapping and OverflowDetermines what happens when the text doesn't fit on one line.
To change the text while the game runs, for example, to update a score, set the component's
text
in a script.
label.text = tostring(score)
Don't use emoji in text. The game fonts don't include them.

Image

An Image element shows a picture from your project, such as a logo or a background. To add one, drag an image from the Project window onto the canvas, or add an Image element and set its Sprite.

Image properties

The Image component contains the following main settings.

Setting

Description

SpriteSets the picture to show.
ColorSets a color to tint the picture.
Image TypeSets how the picture fills its box: Simple, Sliced (stretches without distorting corners), Tiled (repeats), or Filled (shows part of the picture, for meters and timers).
Preserve AspectKeeps the picture's proportions.
Set Native SizeResizes the box to the picture's own size.
An image has square corners. For rounded corners, use a Shape, or a sprite with rounded borders.

Icon

An Icon element shows a symbol from a built-in set of more than 1500 icons, such as a heart, a coin, or an arrow. A new Icon shows a star.
To choose an icon:
  1. In the Inspector window, select Icon.
  2. Search for the icon by name. You can also search for what it's for, for example,
    health
    finds a heart.
The icon fills the shorter side of its box, so resize the box to resize the icon.

Icon properties

The following table describes the settings of an Icon element.

Setting

Description

IconSets the symbol to show.
ImageSets a picture to show instead of the icon.
Tint imageTints the picture with the Color. Appears when you set an Image.
ColorSets the icon color.
To change the icon while the game runs, set its
icon
in a script, for example,
icon.icon = 'heart-break'
.

Shape

A Shape element is a rectangle that Unity Spark draws itself, so it needs no art and stays sharp at any size. Use shapes for panels, cards, frames, and backgrounds. Buttons, sliders, toggles, and progress bars are also made from shapes.

Shape properties

The Shape component contains the following sections.

Section

Description

FillSets a Solid color or a Linear gradient, and an optional Image.
CornersSets the corner Radius. A large radius makes the ends fully round.
StrokeAdds a border. Select Add stroke, then set its Color and Width.
ShadowAdds a drop shadow. Select Add shadow, then set its Color, Offset, and Blur.
ProgressSets how much of the shape is filled, and from which direction. Refer to Progress bars.
An element can have only one of Text, Image, or Shape. To put text on a shape, place the Text element inside the shape in the Hierarchy window.

Additional resources