bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.46k stars 3.6k forks source link

Allow disabling picking backends without disabling features. #16472

Closed andriyDev closed 6 days ago

andriyDev commented 6 days ago

What problem does this solve or what need does it fill?

Today, in order to disable the sprite picking backend and UI picking backend, you have to disable a feature. These backends are inserted in SpritePlugin and UiPlugin respectively if the features are enabled. This makes it cumbersome to disable these backends: you have to disable all bevy default features, and then re-enable all features except the picking backends you don't want.

What solution would you like?

If the corresponding feature is enabled, we should add a bool to SpritePlugin and UiPlugin to indicate whether to add the backend. This keeps the existing behaviour that by default, the backends are included. However advanced users can replace these plugins in DefaultPlugins, setting the bool to false to disable the backends.

Additional comments

Note we don't need to do this for the mesh picking backend since it is not included by default: Users must explicitly add the plugin themselves.