Replies: 2 comments 3 replies
-
There is a PR (#6411) that solves this issue by disallowing addition of plugins multiple times unless explicitly allowed. IMO I think the user should add |
Beta Was this translation helpful? Give feedback.
3 replies
-
Taking a look at common dependencies, they seem to follow a pattern of "if plugin not added yet, add it myself":
Sources: Is this the pattern recommended for libraries offering plugins that depend on other third party plugins? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It seems
app.add_plugin(MyPlugin)
just directly callsMyPlugin::build(app)
. This means, if the same plugin gets called multiple times from different places, itsbuild
function would be called multiple times. What are best practices around this? I imagine it could break things since bevy relies so heavily on global state (in the form of resources).One probably common example I can think of is if you build a game that uses multiple plugins, say
PluginA
andPluginB
, and each of those plugins rely on a GUI plugin, say bevy-egui. Who should callapp.add_plugin(bevy_egui::EguiPlugin)
? ShouldPluginA
andPluginB
not call that and instead document that they rely on it and that the main app needs to calladd_plugin(EguiPlugin)
? ShouldPluginA
andPluginB
both calladd_plugin(EguiPlugin)
and shouldEguiPlugin
be written in a way that it can handle being called multiple times? Should bevy itself somehow handle this and deduplicate those calls?Beta Was this translation helpful? Give feedback.
All reactions