Skip to content
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

Need a way to call the setup() of the plugins that have been registered in the App manually #7576

Closed
jinleili opened this issue Feb 9, 2023 · 0 comments
Labels
A-App Bevy apps and plugins C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@jinleili
Copy link
Contributor

jinleili commented Feb 9, 2023

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

Due to changes in #7046, it is now necessary to have a way to call the setup function of the plugins that have been registered in the App when using an external event loop to drive a bevy App.

// temporarily remove the plugin registry to run each plugin's setup function on app.
let mut plugin_registry = std::mem::take(&mut app.plugin_registry);
for plugin in &plugin_registry {
plugin.setup(&mut app);
}
std::mem::swap(&mut app.plugin_registry, &mut plugin_registry);

What solution would you like?

Make plugin_registry public?

What alternative(s) have you considered?

Move relevant code above into a separate pub fn?

Additional context

External event loop demo: https://github.com/jinleili/bevy-in-app

@jinleili jinleili added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Feb 9, 2023
@alice-i-cecile alice-i-cecile added A-App Bevy apps and plugins C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled C-Feature A new feature, making something new possible labels Feb 9, 2023
@bors bors bot closed this as completed in eeb67ee Feb 9, 2023
myreprise1 pushed a commit to myreprise1/bevy that referenced this issue Feb 11, 2023
# Objective

- Fixes bevyengine#7412
- Fixes bevyengine#7576 

## Solution

- Add a setup function to app, so users can call the plugin `setup` methods before calling `update`.

## Changelog

- add a setup function to app
myreprise1 pushed a commit to myreprise1/bevy that referenced this issue Feb 11, 2023
# Objective

- Fixes bevyengine#7412
- Fixes bevyengine#7576 

## Solution

- Add a setup function to app, so users can call the plugin `setup` methods before calling `update`.

## Changelog

- add a setup function to app
myreprise1 pushed a commit to myreprise1/bevy that referenced this issue Feb 15, 2023
# Objective

- Fixes bevyengine#7412
- Fixes bevyengine#7576 

## Solution

- Add a setup function to app, so users can call the plugin `setup` methods before calling `update`.

## Changelog

- add a setup function to app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-App Bevy apps and plugins C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants