Skip to content

Panic due to incompatible queries #1695

Closed
@runfalk

Description

@runfalk

Bevy version

348e2a3 (master at the time of writing)

Operating system & version

Fedora 33

What you did

I tried to port https://github.com/SarthakSingh31/bevy_4x_camera to work with current master. I'm testing Bevy for some visualization stuff. The changes required to make it compile were pretty minor.

This part is causing me issues though: https://github.com/SarthakSingh31/bevy_4x_camera/blob/440d8ce75736c2c210d4b07e06675e585d97b4ef/src/lib.rs#L87

What you expected to happen

The compiled code should run.

What actually happened

The compiled code panics with this error immediately:

thread 'main' panicked at 'Query<&mut bevy_transform::components::transform::Transform, bevy_ecs::query::filter::With<bevy_render::camera::camera::Camera>> in system &rust_visualizer::camera::camera_rig_movement accesses component(s) bevy_transform::components::transform::Transform in a way that conflicts with a previous system parameter. Allowing this would break Rust's mutability rules. Consider merging conflicting Queries into a QuerySet.', /home/ante/.cargo/git/checkouts/bevy-f7ffde730c324c74/348e2a3/crates/bevy_ecs/src/system/system_param.rs:142:5

Additional information

I suspect there is a problem with the new ECS v2 that was introduced 2 weeks ago. Did the previous system not check for mutability like this? It doesn't know that the second query is only used to query children of the first element. However, I'm still very new to this so that may not be correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and events

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions