#how do i manually request a struct that implements SystemParam from the world

5 messages · Page 1 of 1 (latest)

wheat mauve
#
#[derive(SystemParam)]
struct Foo{
  house:Res<FooHouse>
  familly:Querry<&FooFamily>
}
i want to get this without needing to run a system,
i need to use a non thread safe thing alongside `Foo` so i cant use it inside a system
wheat mauve
#

how to convert Mut to ResMut ?
note : i am using only bevy ecs and bevy ecs macros crates not all bevy

#[derive(SystemParam)]
pub struct Renderer<'w> {
    pub surface: AHResMut<'w, Surface<'static>>,
    pub device: AHResMut<'w, wgpu::Device>,
    pub queue: AHResMut<'w, wgpu::Queue>,
    pub config: AHResMut<'w, wgpu::SurfaceConfiguration>,
    pub sizes: AHResMut<'w, Sizes>
}

impl Renderer<'_> {
    fn new(world:&mut World) -> Self {
        Self{
            surface: world.get_resource_mut::<AHState<Surface>>().unwrap()), 
// its not returning Mut<Something>, how do i get a ResMut
            device: (),
            queue: (),
            config: (),
            sizes: (),
        }
    }
rapid canyon
#

SystemState is the typical way to get a ResMut directly from a World

#

I don't believe it's possible to go from Mut to ResMut, as all ResMuts are Mut but not all Mut are ResMut

outer shadow
#

Why do you need ResMut? Can't you use &mut Something ?