Optional UI rendering#8997
Conversation
`UiPlugin` * Added a bool field `disable_ui_rendering`. * Only calls `build_ui_render` and initializes the `UiPipeline` if `disable_ui_rendering` is false.
alice-i-cecile
left a comment
There was a problem hiding this comment.
I thought about implementing a "bevy_ui_render" feature but suspect everything is too tightly coupled atm and it would be very fragile. Similar to the struggles with the "bevy_text" feature but worse.
I would prefer this solution, especially in the long run, but the struggles are entirely plausible. We should work towards decoupling things here though.
Definitely agree. My preference I think would be to move the UI render module into its own crate. |
This could be fixed by running tests without the |
|
@ickshonpe just waiting on merge conflicts now :) |
Objective
Make UI rendering optional.
Quite a few people have been experimenting with using Bevy UI for layout and interaction but replacing the rendering with
bevy_prototype_lyonor whatever. It's awkward to do though as there is no way to disable the existing UI rendering requiring users to create their own custom node bundles and components. Also, you can't replace the UI's shader and a number of other things.This PR makes the setup and initialization of UI rendering for the RenderApp optional. Then you can do whatever you want by replacing
build_ui_renderwith your own function. For instance, one that loads a custom shader.The UI layout and interaction components are still updated as normal.
Solution
Add a field
enable_renderingtoUiPlugin.Only call
build_ui_renderand initialize theUiPipelineifenable_renderingis false.I thought about implementing a "bevy_ui_render" feature but suspect everything is too tightly coupled atm and it would be very fragile. Similar to the struggles with the "bevy_text" feature but worse.
Changelog
UiPluginenable_rendering.build_ui_renderand initializes theUiPipelineifenable_renderingis true.Migration Guide
UiPluginhas a new fieldenable_rendering. If set to false, the UI's rendering systems won't be added to theRenderAppand no UI elements will be drawn. The layout and interaction components will still be updated as normal.