CommandToolbar
UI Toolkit VisualElement providing an interactive command search field with fuzzy-matched results, keyboard navigation, and rich text highlighting. Loaded from a UXML template, it displays a TextField for input and a ListView for search results. Users type to search, navigate with Tab/Arrow keys, and press Enter to execute. Hosted by CommandToolbarOverlay in the SceneView.
Definition
Namespace: Paragon.Core.Command.Editor Assembly: Paragon.Editor.dll
[EditorToolbarElement(id, typeof(SceneView))]
public class CommandToolbar : VisualElementInheritance: VisualElement → CommandToolbar
Remarks
CommandToolbar is the core interactive element of the command toolbar overlay. It orchestrates:
Input handling — The
TextFieldcaptures user input and triggers fuzzy search via CommandSearch.Results display — The
ListViewrenders sorted CommandSearchResult entries with matched characters highlighted in gold (#ffd700) using rich text tags.Keyboard navigation — Tab/Down arrow cycles forward, Up arrow cycles backward, Space locks selection, Escape/Backspace clears selection, Enter executes.
Execution — Parses the input into a command name and parameters, then delegates to
Command.Execute().
The toolbar only shows commands with zero parameters in search results (parameterized commands are filtered out to avoid complex toolbar interaction).
Keyboard Shortcuts
Tab / Down Arrow
Highlight next result (cycles)
Up Arrow
Highlight previous result (cycles)
Space
Lock highlighted result and refine search
Escape / Backspace (when highlighting)
Clear highlight, restore filter text
Enter
Execute the current input as a command
Result Text Format
Matched characters are wrapped in gold <color=#ffd700> tags. Parameters are appended in dimmed gray (#808080AA):
Properties
IsHighlightingResult
Returns true when a search result is currently highlighted (selected via keyboard navigation).
Methods
Initialize
Sets up the toolbar UI from the UXML template, configures the ListView and TextField, and registers input callbacks. Must be called after construction.
overlay
CommandToolbarOverlay
The hosting overlay, used for position adjustments when results list resizes
Common Pitfalls
Only parameterless commands appear in results The search filter excludes commands with ParameterCount > 0. Parameterized commands can still be executed by typing the full command name and arguments, then pressing Enter — but they won't appear in the autocomplete list.
UXML asset path is hardcoded The toolbar loads its UI from Assets/Paragon/Core/Command/Editor/Toolbar/CommandToolbar.uxml. Moving the file will break initialization.
Overlay position adjusts with results When the results list grows or shrinks, the toolbar adjusts overlay.floatingPosition to keep the layout stable. This coupling means the toolbar must always have a reference to its hosting overlay.
See Also
CommandToolbarOverlay — the SceneView overlay hosting this toolbar
CommandSearch — fuzzy search engine producing results
CommandSearchResult — result records with match metadata
Command — static facade for execution
Command Toolbar — toolbar subsystem overview
Last updated