-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draw the UI debug overlay using the UI renderer #16693
Conversation
* Added `UiDebugOptions` resource that can be used to enable or disable the debug overlay and set the line width. * New `extract_debug_overlay` system that extracts the node geometry for rendering.
Can we get a rounded node in the example to ensure we don't break this later? |
The rotated bevy logo in the bottom left has a rounded debug outline (the blue outline). |
Oh I missed that 😅 |
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a much simpler and more reliable way to do this: I really prefer it. That said, we should clean up and remove the old approach in this PR, and write a migration guide.
I don't feel strongly about "where should this live": bevy_dev_tools is in a weird spot currently, but if this lives in bevy_ui we should probably feature flag it.
It seems to me that |
* Added `toggle` method to the `UiDebugOptions` resource struct. * Updated `testbed_ui` example to use the new overlay.
You added a new feature but didn't update the readme. Please run |
You added a new feature but didn't update the readme. Please run |
I backported and tested this on the 0.15 release. Works beautifully. |
@ickshonpe I'm going to count that as a second approval. Ping me when this is up to date with main please :) |
@alice-i-cecile should be ready now. We're just ignoring the failing check-advisories CI for the moment? |
Yeah, it's blocked on an upstream fix :( |
Objective
Draw the UI debug overlay using the UI renderer.
Significantly simpler and easier to use than
bevy_dev_tools::ui_debug_overlay
which usesbevy_gizmos
.Fixes #16666
Solution
Removed the
ui_debug_overlay
module frombevy_dev_tools
.Added a
bevy_ui_debug
feature gate.Draw the UI debug overlay using the UI renderer.
Adds a new module
bevy_ui::render::debug_overlay
.The debug overlay extraction function queries for the existing UI layout and then adds a border around each UI node with
u32::MAX / 2
added to each stack index so it's drawn on top.There is a
UiDebugOptions
resource that can be used to enable or disable the debug overlay and set the line width.Testing
The
testbed_ui
example has been changed to use the new debug overlay:Press Space to toggle the debug overlay on and off.
Showcase
Migration Guide
The
ui_debug_overlay
module has been removed frombevy_dev_tools
.There is a new debug overlay implemented using the
bevy_ui
renderer. To use it, enable thebevy_ui_debug
feature and set theenable
field of theUiDebugOptions
resource totrue
.