Introduction to UI Agent
Route UI-related prompts through the UI Agent that generates, validates, previews, and assembles UI Toolkit assets in the Unity Editor.
UI Agent creates UI assets and supporting assets, including UXML documents (.uxml), USS stylesheets (.uss), Panel Settings assets (such as PanelSettings, PanelTextSettings, and ThemeStyleSheet), sprite assets for UI visuals, and UXML schema files for validation. It validates the generated files, resolves missing schema dependencies when required, and produces previews so that you can review visual output before saving. You don't manually select the UI Agent. Assistant detects UI-related intent in your prompt and routes the request automatically.
The UI Agent can also retrieve project context when needed. For example, if it needs a background image for a UI layout, it can use shared context tools, such as Find Project Assets to search your project for necessary assets. These context tools are shared between Assistant and the UI Agent.
Note
UI Agent works with UI Toolkit assets, such as UXML, USS, and Panel Settings. If you’re new to UI Toolkit, familiarize yourself with its basic concepts to help you better understand and customize the user interface (UI) that the UI Agent generates. For more information, refer to the UI Toolkit documentation.
UI Agent behavior in Ask and Agent modes
UI Agent behavior changes depending on whether you use the Ask mode or Agent mode.
Ask mode behavior
In the Ask mode, the UI Agent supports design exploration and validation without creating UI assets:
- Doesn't create or save the
.ussstylesheets or.uxmlUI documents. - Uses validation tools only to help you evaluate the UI output safely.
- Generates and saves UXML schema files automatically if needed for correct validation.
- Doesn't request permission because no UI documents, styles, or assets are written to your project.
Use the Ask mode to do the following:
- Explore UI ideas.
- Review layouts visually.
- Check structure and validation before committing changes.
Agent mode behavior
In the Agent mode, the UI Agent performs full UI generation and refinement:
Generates
.uxmlUI documents and.ussstyle sheets.Generates Panel Settings assets, including:
PanelSettingsPanelTextSettingsThemeStyleSheet
Generates and saves UXML schemas for validation if needed.
Generates sprite assets when UI visuals require them.
Validates all generated assets and fixes issues automatically.
Performs visual review of the generated UI and:
- Refines the layout and styling
- Modifies the UI until it meets the intent of your request
Requests permission before saving UI documents, styles, sprites, and Panel Settings assets.
Saves approved UI assets to disk after confirmation.
Use the Agent mode to do the following:
- Create production-ready UI.
- Iterate rapidly on real UI layouts.
- Automatically fix validation and visual issues
Assistant saves all the UI files that are generated by the UI Agent in your project's Assets/UI folder. File roles are defined by extension, such as .uss for styles and .uxml for UI document, and sprite assets for visual elements. Generated Panel Settings asset files might result in Assets/UI folder or Assets/UI Toolkit/UnityThemes folder depending on the file type.
For more information on different Assistant modes, refer to Assistant Ask and Agent modes.