bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Make `HierarchyQueryExt` work with `QueryState`

Open DasLixou opened this issue 1 year ago • 2 comments

What problem does this solve or what need does it fill?

For exclusive systems, getting multiple queries with query_state is easy and you can pass them world access. However, getting an actual Query, where the HierarchyQueryExt trait is implemented, only works over DeferredWorld, which can easily result in a use of borrowed value here error.

What solution would you like?

Add the possibility to use methods from HierarchyQueryExt with QueryState and &mut World

What alternative(s) have you considered?

#14869

DasLixou avatar Aug 22 '24 13:08 DasLixou

It's not entirely clear to me how this would fix the issue. If HierarchyQueryExt is changed to require &mut World you still won't be able to use it with a DeferredWorld

SkiFire13 avatar Aug 22 '24 13:08 SkiFire13

@SkiFire13 I can use it with DeferredWorld, which is what I do currently. Creating a deferred world, making a query out of query state and using that. Problem here is that DeferredWorld consumes the whole world, which I need for other queries. This probably plays better hand in hand with #14869 than being an alternative.

DasLixou avatar Aug 22 '24 13:08 DasLixou