← All docs

UI Canvas

Claunity can build complete Unity UI — from a single button to a full main menu. It handles Canvas setup, anchors, sizes, and layout groups automatically. TextMeshPro is used by default when available.

Auto Canvas creation

If you ask for a UI element without an existing Canvas in the scene, Claunity creates one automatically — with CanvasScaler (1920×1080, Scale With Screen Size) and EventSystem included.


Canvas setup

Create a Canvas

"Create a UI Canvas set up for 1920×1080 with Screen Space — Overlay and a CanvasScaler"

Canvas is created automatically

"Add a Play button to the scene — Claunity creates a Canvas automatically if one does not exist"

Creating UI elements

Add a button

"Add a Play button centered on the screen with a blue background and white text"

Add text

"Add a TextMeshPro score label in the top-right corner of the screen"

Add an image

"Add a health bar panel in the bottom-left with a red fill image"

Add a panel

"Create a semi-transparent dark panel that covers the full screen (for a pause menu background)"

Add a slider

"Add a volume slider to the Settings panel"

Add an InputField

"Add a player name input field with placeholder text "Enter your name...""

Layout & positioning

Set anchor and position

"Move the health bar to the bottom-left corner, 20px from each edge"

Set size

"Resize the "PlayButton" to 200×60 pixels"

Add layout groups

"Add a Vertical Layout Group to the "MenuPanel" with 10px spacing between items"

Stretch to fill

"Make the "Background" panel stretch to fill the entire Canvas"

Full UI setups

Main menu

"Create a main menu UI with Play, Settings, and Quit buttons, centered vertically on screen"

HUD

"Create a game HUD with a health bar in the top-left and score text in the top-right"

Pause menu

"Create a pause menu with a semi-transparent overlay and Resume, Restart, Quit buttons"