Skip to content

Ambiguity checker is unaware of run criteria (including States) #1693

Open
@alice-i-cecile

Description

Bevy version

348e2a3d404bc61afe534371b100dc173f6d076f

Operating system & version

Irrelevant.

What you did

use bevy::ecs::schedule::ReportExecutionOrderAmbiguities;
use bevy::prelude::*;

#[derive(Clone, Eq, PartialEq)]
enum AppState {
    Menu,
    InGame,
}

#[derive(Default)]
struct Data;

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_state(AppState::Menu)
        .init_resource::<Data>()
        .insert_resource(ReportExecutionOrderAmbiguities)
        .add_system_set(SystemSet::on_update(AppState::Menu).with_system(menu.system()))
        .add_system_set(SystemSet::on_update(AppState::InGame).with_system(game.system()))
        .run();
}

fn menu(mut _data: ResMut<Data>) {}
fn game(mut _data: ResMut<Data>) {}

What you expected to happen

No ambiguities should be found.

What actually happened

A system-order ambiguity between menu_system and gameplay_system was found.

 * Parallel systems:
 -- "&bevy_scratchpad::game" and "&bevy_scratchpad::menu"
    conflicts: ["bevy_scratchpad::Data"]

Additional information

First reported here.

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsA-StatesApp-level states machinesC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    • Status

      Needs Implementation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions