bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Support using FilteredResources with ReflectResource.

Open chescock opened this issue 1 year ago • 0 comments

Objective

Support accessing resources using reflection when using FilteredResources in a dynamic system. This is similar to how components can be queried using reflection when using FilteredEntityRef|Mut.

Solution

Change ReflectResource from taking &World and &mut World to taking impl Into<FilteredResources> and impl Into<FilteredResourcesMut>, similar to how ReflectComponent takes impl Into<FilteredEntityRef> and impl Into<FilteredEntityMut>. There are From impls that ensure code passing &World and &mut World continues to work as before.

Migration Guide

If you are manually creating a ReflectComponentFns struct, the reflect function now takes FilteredResources instead &World, and there is a new reflect_mut function that takes FilteredResourcesMut.

chescock avatar Oct 03 '24 16:10 chescock