#System with `Changed` does not query entities that had `set_changed` called on them

4 messages · Page 1 of 1 (latest)

open sinew
#

I have a system that depends on a Component that wraps a InstanceId, and on it I check if the InstanceId is ready, and if not, I call set_changed on the Component expecting it to run again on the next frame, but it does not

fn update_modular<T: Component + Deref<Target = InstanceId>>(
    mut changed_modular: Query<(Entity, &mut T), Changed<T>>,
    children: Query<(Option<&Name>, &Children)>,
    mut scene_spawner: ResMut<SceneSpawner>,
) {
    for (entity, mut modular) in &mut changed_modular {
        println!("Changed {:?}", entity);
        if scene_spawner.instance_is_ready(**modular) {
            println!("Instance ready");
            // Move mesh to parent
            todo!();
        } else {
            println!("Instance not ready");
            modular.set_changed();
        }
    }
}

Output

Changed 2v1
Instance not ready

No change of behavior by removing the generic

open sinew
#

Created an event and a system that reads the event, and calling set_changed on that system

dapper sandal
#

Systems don't see changes made by themselves

delicate trellis