View with UI and game scene items

Hello there.

The work you have done with UI Toolkit is really great, thank you so much.

I’d like to suggest a functionality.
I’d like to have a new tab (e.g. that I can place next to the scene tab) that shows me how the UI is being visualized from the camera in the scene, something similar to the previous Canvas visualization, but for UI toolkit.

I know that now it is being viewed in the game tab, but I consider it would be good this new tab in case you need to move items of the UI, replace text, UI preview, etc.

Also, because we are going to need several UI items, nested ones, etc. and to preview them in the scene before entering play mode would be great.

Thanks for your time!

Some of the things you describe can be done in the UI Toolkit Debugger window and/or UI Builder window. Have you played around with them?

2 Likes

I discovered that the UI Builder has an option to set the main Camera as the Canvas background, and it does what is required.

If you are using bindings there is way to specify an object that provide the data to help with visualizing the UI Builder. Usually this would be mapped to a scriptableObject for quickly changing the values.

You can also enable the live reload in the game view from the top right corner menu. Live reload is a bit aggressive because it fully recreate the UI at every change in the UI builder, so you would have to fetch the references to visual element and set the UI state again in the OnEnable of a component on the same object as the UI document. If your game does not store any state directly in the UI this a good way to speed up iterations once setup. (see Unity - Manual: Get started with runtime UI)

Don’t hesitate to reach out again here is you need help with any of this.

2 Likes