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

Init App.schedule systems when running the app #444

Merged
merged 1 commit into from
Sep 10, 2020
Merged

Init App.schedule systems when running the app #444

merged 1 commit into from
Sep 10, 2020

Conversation

smokku
Copy link
Member

@smokku smokku commented Sep 5, 2020

This PR adds App.schedule.initialize() call before switching to normal App event loop.
It initializes Local<> resources so the systems utilizing it do not crash.

Fixes #221

@karroffel karroffel added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events labels Sep 5, 2020
@cart
Copy link
Member

cart commented Sep 8, 2020

This fixes the issue, but it would result in initialize getting double-called on the first run of apps using WinitPlugin.

To get parity with WinitPlugin's behavior I think we just need to swap this:

RunMode::Once => {
    app.schedule.run(&mut app.world, &mut app.resources);
}

for this:

RunMode::Once => {
    app.update();
}

(same goes for RunMode::Loop)

@smokku
Copy link
Member Author

smokku commented Sep 8, 2020

This fixes the issue, but it would result in initialize getting double-called on the first run of apps using WinitPlugin.

Is that a problem?
initialize() gets called on every frame anyway and just skips already initialized systems.

@cart
Copy link
Member

cart commented Sep 9, 2020

Is that a problem?

In practice probably not. Its mainly an issue of logical consistency. As much as possible schedule runners should behave the same.

This is required, so Local<> resources get initialized before systems run.
@smokku
Copy link
Member Author

smokku commented Sep 9, 2020

I've updated the PR.
It indeed fixes my crash too. :-)

@cart cart merged commit 12deb0b into bevyengine:master Sep 10, 2020
mrk-its pushed a commit to mrk-its/bevy that referenced this pull request Oct 6, 2020
This is required, so Local<> resources get initialized before systems run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding ScheduleRunnerPlugin after default plugin crashes at startup
3 participants