-
ContextI’m updating my project from Bevy 0.16 → 0.17, and ran into a problem with lifecycle hooks and the new In 0.16 I used to do this inside an fn on_insert(mut world: DeferredWorld, ctx: HookContext) {
// Find the primary window
let Some(window) = world.iter_entities()
.find_map(|e| e.get::<Window>().cloned())
else {
warn!("No window found!");
return;
};
info!("Window size: {}x{}", window.width(), window.height());
}That worked fine, but Is there a safe way to query components (e.g. I’ve explored:
I’d like to stay within the hook and keep things safe and modern—no ThoughtsIs this currently an oversight or intentional restriction of Versions
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
you might be able to use try_query to construct a QueryState https://docs.rs/bevy/latest/bevy/ecs/world/struct.DeferredWorld.html#method.try_query |
Beta Was this translation helpful? Give feedback.
you might be able to use try_query to construct a QueryState https://docs.rs/bevy/latest/bevy/ecs/world/struct.DeferredWorld.html#method.try_query