bytestring-net / bevy_lunex

Blazingly fast path based retained layout engine for Bevy entities, built around vanilla Bevy ECS.
https://bytestring-net.github.io/bevy_lunex/
Apache License 2.0
520 stars 22 forks source link

Don't automatically add `bevy_mod_picking` #73

Closed musjj closed 1 week ago

musjj commented 1 week ago

I have configured bevy_mod_picking in my project like this:

DefaultPickingPlugins
    .build()
    .disable::<InputPlugin>()
    .add(MyOwnCustomInputPlugin)

But unfortunately, bevy_lunex hardcodes the bevy_mod_picking plugin making it completely incompatible with my project.

IMO this should generally be considered an anti-pattern. Plugins should generally not automatically add other plugins (unless it's something internal that the user will never use). Maybe consider using a PluginGroup instead which gives the user more control.

Or better, don't add it automatically and instead add a note in the documentation that this plugin depends on bevy_mod_picking and include a snippet for setting them up.

IDEDARY commented 1 week ago

Yes, thats something that lied in my conscience for a while. I didn't really figure out what the best solution for this is, but what you are suggesting makes sense. I will see if I can implement it asap :3

IDEDARY commented 1 week ago

Fixed with PR74.

UiPlugin was split into UiDefaultPlugins and UiMinimalPlugins variants.

Please check docs for the new picking requirements.

musjj commented 1 week ago

Wow thanks a lot, that's really fast!

What exactly do I need to add to achieve UiDefaultPlugins minus the DefaultPickingPlugins? Should I add UiGenericPlugins::<MainUi> plus UiLogicPlugin?

Though tbh, I feel that it's better to just not add DefaultPickingPlugins in any of the plugin groups and let the user add it themselves. It's a pretty big group. Actually, skimming through the code, I think that bevy_lunex doesn't really need to depend on anything beyond bevy_picking_core.

IDEDARY commented 1 week ago

@musjj Maybe. But these are minor details which will be addressed once 0.15 lands. Bevy mod picking is getting up-streamed, so I any further changes are pointless. It will soon be native to Bevy :)

What exactly do I need to add to achieve UiDefaultPlugins minus the DefaultPickingPlugins?

Everything except the DefaultPickingPlugins that you can find in the source code. Ex. UiGenericPlugins::<MainUi> + UiLogicPlugin + (UiLunexPickingPlugin) (Just backend for Picking Lunex nodes)

musjj commented 1 week ago

But these are minor details which will be addressed once 0.15 lands

Alright, that makes sense :)

Everything except the DefaultPickingPlugins that you can find in the source code

Thanks this works!