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

ChainSystem's Local<T> resources fail to be added #885

Closed
memoryruins opened this issue Nov 18, 2020 · 1 comment · Fixed by #886
Closed

ChainSystem's Local<T> resources fail to be added #885

memoryruins opened this issue Nov 18, 2020 · 1 comment · Fixed by #886
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior

Comments

@memoryruins
Copy link
Contributor

While experimenting with the recent additions from #876, the following issue appeared while using a Local<T> in either system of a ChainSystem. It appears that the Locals are never added when the systems are initialized.

Bevy version

d6eb647

What you did

use bevy::prelude::*;

fn system() {}
fn system_with_local(_: Local<u8>) {}
fn handler(In(()): In<()>) {}
fn handler_with_local(In(()): In<()>, _: Local<u8>) {}

fn main() {
    App::build()
        // the follow are ok
        .add_system(system)
        .add_system(system.chain(handler))
        .add_system(system_with_local)
        // the following panic with the message: "panicked at 'Resource does not exist u8'"
        .add_system(system_with_local.chain(handler))
        .add_system(system.chain(handler_with_local))
        .add_system(system_with_local.chain(handler_with_local))
        .run();
}

cargo run

What you expected to happen

The app to run silently then promptly exit.

What actually happened

When the systems run, the app panics with the message panicked at 'Resource does not exist u8'.

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

cart commented Nov 18, 2020

Good catch. Looks like the true culprit here is this default impl:

image

I used rust-analyzer's "add missing items" completion to implement System, which doesn't populate default impls. Not quite sure why I added that default impl in the first place.

Should be a straightforward fix.

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 a pull request may close this issue.

2 participants