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 , and its size changes automatically to fit its box.
New TextGive 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 Style | Sets the font, and whether the text is bold or italic. |
| Text | Sets the words to show. |
| Horizontal Align and Vertical Align | Sets how the text lines up inside its box. |
| Size | Sets the text size. When Auto-Size is enabled, set Min Size and Max Size instead. |
| Auto-Size | Shrinks the text to fit its box. |
| Color | Sets the text color. |
| Wrapping and Overflow | Determines 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 in a script.
textlabel.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 |
|---|---|
| Sprite | Sets the picture to show. |
| Color | Sets a color to tint the picture. |
| Image Type | Sets 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 Aspect | Keeps the picture's proportions. |
| Set Native Size | Resizes 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:
- In the Inspector window, select Icon.
- Search for the icon by name. You can also search for what it's for, for example, finds a heart.
health
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 |
|---|---|
| Icon | Sets the symbol to show. |
| Image | Sets a picture to show instead of the icon. |
| Tint image | Tints the picture with the Color. Appears when you set an Image. |
| Color | Sets the icon color. |
To change the icon while the game runs, set its in a script, for example, .
iconicon.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 |
|---|---|
| Fill | Sets a Solid color or a Linear gradient, and an optional Image. |
| Corners | Sets the corner Radius. A large radius makes the ends fully round. |
| Stroke | Adds a border. Select Add stroke, then set its Color and Width. |
| Shadow | Adds a drop shadow. Select Add shadow, then set its Color, Offset, and Blur. |
| Progress | Sets 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.