bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Make Query::new() pub

Open JMS55 opened this issue 2 years ago • 4 comments

Changelog

  • Added Query::new() for low-level, unsafe uses of the ECS world.

JMS55 avatar Dec 07 '23 21:12 JMS55

Probably needs more expansive doc comments, but I'll leave that up to the ECS people who know what they're talking about :)

JMS55 avatar Dec 07 '23 21:12 JMS55

Should this be controversial? It makes a private API public. But it is already marked as unsafe, so is that enough?

Nilirad avatar Dec 09 '23 06:12 Nilirad

For reference, here's what I'm trying to achieve: https://github.com/JMS55/bevy_dioxus/blob/main/src/hooks.rs#L104-L125

fn ui_root(cx: Scope) -> Element {
    let names = use_query::<DebugName>(cx);

    render!(
        for name in names.query() {
            "{name:?}"
        }
    )
}

JMS55 avatar Dec 13 '23 01:12 JMS55

Using SystemState worked, but has the unfortunate side effect of requiring things to be mut https://github.com/JMS55/bevy_dioxus/pull/19

JMS55 avatar Jan 24 '24 18:01 JMS55