Test UI behavior before and during Play mode, view edits in context across multiple windows, and automate tests for repeatable verification.
To test layout, control states, and hover styles in the UI Builder, refer to Test UI in UI Builder.
Use the UI Viewport window to preview animations, hover states, and interactive behavior without entering Play mode.
To enable preview in the UI Viewport window:
When you enable Preview, Unity does the following:
In Preview mode, you can test the following:
Foldout. Expand a Foldout to view how the rest of the UI reacts.In Preview mode, you can still work on your UI. However, Preview mode disables Canvas picking and manipulators.
To exit Preview mode, disable Preview. The Canvas returns to editing mode with picking and manipulator handles.
To test the UI in Play mode, enter Play mode and interact with the UI. To add a Panel Renderer component to a scene and connect the UI to a panel, refer to Panel Renderer component.
In Play mode, check the following:
MonoBehaviour finds the elements it queries. With Panel Renderer, run initialization logic from a UI reload callback rather than from OnEnable. The callback runs when the visual tree first loads and again after every live reload, so element references stay valid. For more information, refer to Lifecycle of Panel Renderer components.To apply changes to a UXML or USS file without re-entering Play mode, refer to UI Toolkit live reload.
To inspect elements, USS selectors, and event routing at runtime, refer to UI Toolkit Debugger and Event Debugger.
If you don’t know where a style comes from, check the Matching Selectors section of the element’s Inspector.
To view the matching selectors for an element:

The Matching Selectors section displays the following:
Note: USS selectors that appear lower in the list always override the same style properties in higher USS selectors.
If the Matching Selectors section doesn’t provide enough information, use the UI Toolkit Debugger. It provides a visual representation of your UI hierarchy so that you can inspect the state and properties of each UI element in real time.
Dock the UI Viewport alongside the Scene and Game views to view your edits in all three contexts at once.
Each view shows a different perspective:
For complex UIs or long test cycles, automated testing helps you catch regressions without manual interaction. For repeatable tests that run in continuous integration (CI), use the UI Test Framework to write automated tests against your UI elements.