Introduction to game UI
Understand how the UI Editor, canvases, UI styles, and anchors work together to create your game's interface in Unity Spark.
Read time 3 minutesLast updated 3 hours ago
The UI Editor
The UI Editor is a flat view of your game's screen where you drag elements into place. Menus, scores, health bars, and buttons are all placed on a canvas. A UI style gives every element a consistent appearance, and anchors keep elements in place when the screen size changes.
The UI Editor opens as a tab next to the Scene view when you select a UI element. It shows one canvas at a time. In it, you place, align, and anchor elements so they fit any screen. The UI Editor isn't available in the Chat and Chat wide layouts. It's available in other layouts, such as Editor.
The UI Editor opens only for UI that's drawn on the screen. For a canvas in the 3D world, such as a sign or a floating health bar, edit it in the Scene view instead.
Canvases
A canvas is a container for all the elements that make up a screen in your game. Each canvas has its own UI Editor tab. You can have multiple canvases in a scene, for example, one for the main menu and another for the heads-up display (HUD).
New projects already include a canvas called . If you add any UI element to a scene without a canvas, Unity Spark creates one for you.
UI CanvasUnity Spark lays out canvases with a reference resolution of 1920 × 1080 (16:9). The canvas takes the screen shape you pick in the aspect-ratio menu, for example, 1080 × 1920 for 9:16. With Free, the default, the canvas follows the shape of the Scene view. Your UI scales with the screen, so it keeps its proportions on any display.
UI styles
The UI Style settings set the appearance of every element that follows the style, all at once. Your project has one UI style.
Pick the style before you add elements, so new elements match from the start. Buttons, toggles, sliders, scrollbars, input fields, dropdowns, scroll views, and progress bars that you add from the toolbar follow the style, and so do elements that the AI assistant creates. Style changes apply to them automatically. Text, images, icons, and shapes that you add from the toolbar don't have a style role, so they don't follow the style. If you restyle one of these elements by hand, the next style change overwrites your changes. An element that you detach from the style keeps its own styling, and style changes no longer affect it. For instructions, refer to Give your UI a style.
Anchors
Anchors decide which part of the screen an element stays attached to when the screen size changes. For example, a score in the top-left corner stays in the top-left corner, and a full-screen background stretches to fill the screen.