-
Notifications
You must be signed in to change notification settings - Fork 56
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
Depend on bevy's subcrates directly instead of as bevy
features
#219
Comments
bevy_asset
and bevy_state
crates directly instead of via bevy
bevy
features
Well.. I still think this is undesirable behavior but that seems to be controversial on the bevy discord. I'm willing to write a PR for this if wanted, but otherwise feel free to close. |
In this case my expectation would be that said 3rd-party states alternative only adds the states plugin if it isn't added yet. Bevy has an API for that (see e.g. how bevy_asset_loader adds an internal plugin). The only scenario in which I would find it surprising that bevy_asset_loader adds the states plugin is if it is used without a loading state. It would be a separate issue though to support that in my opinion. |
There's also the prelude issue. For example, the <App as OtherAppExt>::init_state::<S>(&mut app) To prevent this, the 3rd-party states plugin would have to use a different name (like So you have to make a choice between a worse API but compatible with crates that inject the However, there would be no incompatibility if all 3rd-party crates depended on subcrates directly. The crux of the issue is that |
The preview issue is a good point. I chose the easy way out with
I think I see your point. The default in Bevy is to add the We could of course have Could you link to the discussion on Discord that you mentioned in your first comment? |
Sure, conversation started here: https://discord.com/channels/691052431525675048/692572690833473578/1252386279996395581. |
I've fixed this in a fork so that I can use [patch.crates-io]
bevy_asset_loader = { git = "https://github.com/benfrankel/bevy_asset_loader.git", branch = "direct-depend" } Created a PR because it takes no additional effort to do so. |
If I have the following in my game's
Cargo.toml
:Then
bevy_asset_loader
will inject thebevy_state
feature into mybevy
dependency. As a result:use bevy::prelude::*;
will pull inbevy_state::prelude::*
.app.add_plugins(DefaultPlugins)
will set upbevy_state::StatesPlugin
.This is unexpected; it makes
bevy_asset_loader
incompatible with 3rd-party alternatives tobevy_state
; and it increases the compile time ofbevy_asset_loader
on its own.bevy_asset_loader
only needs access tobevy_state
, not the fullbevy/bevy_state
feature which has greater implications. Depending on subcrates directly would resolve these issues.The text was updated successfully, but these errors were encountered: