Bevy: ChainSystem's Local<T> resources fail to be added

Created on 18 Nov 2020  路  1Comment  路  Source: bevyengine/bevy

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

https://github.com/bevyengine/bevy/commit/d6eb64745176c42cd225492405df25b0e42793b3

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'.

bug ecs

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cart picture cart  路  23Comments

cart picture cart  路  80Comments

qarmin picture qarmin  路  28Comments

coolit picture coolit  路  22Comments

cart picture cart  路  14Comments