-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Milestone
Description
Bevy version
Bevy main (ce5a82b) which is around 0.16-rc.3 tag.
What you did
I tried to run the following code:
use bevy::prelude::*;
#[derive(Component)]
struct Selected;
fn main() {
App::new()
.add_systems(Update, system_a.pipe(system_b))
.run();
}
fn system_a() -> i32 {
123
}
fn system_b(_: In<i32>, _: Single<Entity, With<Selected>>) {}What went wrong
This code panics due to Single not matching any entities in the piped system. This behavior differs from using Single in a regular system, where it will instead just skip system execution.
Panic Message
thread 'TaskPool (6)' panicked at ~/Projects/bevy/crates/bevy_ecs/src/system/system_param.rs:445:14:
The query was expected to contain exactly one matching entity.: NoEntities("bevy_ecs::system::query::Query<bevy_ecs::entity::Entity, bevy_ecs::query::filter::With<hello_world::Selected>>")
stack backtrace:
0: rust_begin_unwind
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/std/src/panicking.rs:692:5
1: core::panicking::panic_fmt
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/panicking.rs:75:14
2: core::result::unwrap_failed
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/result.rs:1704:5
3: core::result::Result<T,E>::expect
at ~/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:1061:23
4: <bevy_ecs::system::query::Single<D,F> as bevy_ecs::system::system_param::SystemParam>::get_param
at ./crates/bevy_ecs/src/system/system_param.rs:443:22
5: <(P,) as bevy_ecs::system::system_param::SystemParam>::get_param
at ./crates/bevy_ecs/src/system/system_param.rs:2144:20
6: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
at ./crates/bevy_ecs/src/system/function_system.rs:734:22
7: <bevy_ecs::system::combinator::PipeSystem<A,B> as bevy_ecs::system::system::System>::run_unsafe
at ./crates/bevy_ecs/src/system/combinator.rs:407:9
8: <bevy_ecs::system::schedule_system::InfallibleSystemWrapper<S> as bevy_ecs::system::system::System>::run_unsafe
at ./crates/bevy_ecs/src/system/schedule_system.rs:64:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `Pipe(hello_world::system_a, hello_world::system_b)`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!