Toolbar buttons
WorkspaceToolbar is a row at the top of the workspace. The workspace viewport starts below it. Buttons that do not fit go to a new row.
WorkspaceToolbarButton opens the window with its window-id. If the window is open, it focuses it.


Video tutorial: Toolbar and windows. All videos: Video tutorials.
<tb:Workspace>
<tb:WorkspaceToolbar>
<tb:WorkspaceToolbarButton window-id="Inventory" title="Inventory" />
<ui:Button name="arrange" text="Arrange" class="tb-toolbar-button" />
</tb:WorkspaceToolbar>
</tb:Workspace>
WorkspaceToolbarButton attribute |
Meaning |
|---|---|
window-id |
Id of the window to open. |
title |
Button text, used when text is not set. The text follows the title until you set other text. |
In UI Builder
On the canvas, the toolbar shows a dashed outline and the name "WorkspaceToolbar" over its buttons. The outline takes no place in the row, so the buttons sit where they sit in Play mode. An empty toolbar keeps the height of the name, so you can drop buttons into it.
The canvas draws each window below the toolbar, as the workspace places it in Play mode. When the toolbar gets taller, for example when its buttons go to a second row, the windows move down with it.
For other commands, put a normal Button in the toolbar and handle clicked:
using UIToolbox;
using UIToolbox.Utils;
using UnityEngine.UIElements;
public static class ToolbarSetup
{
public static void Bind(Workspace workspace)
{
var arrange = workspace.Q<Button>("arrange");
arrange.clicked += () =>
AsyncRunner.Run(() => workspace.AutoArrangeAsync(),
"Auto arrange");
}
}