bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Texture in render_to_texture example doesn't update

Open rparrett opened this issue 1 year ago • 4 comments
trafficstars

Bevy version

main (cfcb6885e3b475a93ec0fe7e88023ac0f354bbbf), since #10520

Seemingly not fixed by #11212

Relevant system information

AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
SystemInfo { os: "MacOS 13.6.2 ", kernel: "22.6.0", cpu: "", core_count: "10", memory: "64.0 GiB" }

What you did

cargo run --example render_to_texture

What went wrong

Brown cube displayed on cube faces should also be doing its own rotation, but it's not.

rparrett avatar Jan 06 '24 23:01 rparrett

Also pixel_grid_snap

In both case, triggering change detection on the material / the sprite updates it

mockersf avatar Jan 07 '24 08:01 mockersf

In both case, triggering change detection on the material / the sprite updates it

Could you elaborate on that? What exactly is going wrong and how do we fix it?

doonv avatar Jan 14 '24 17:01 doonv

I found a temporary fix for this. Everything you need to do is to run this every frame:

// images: ResMut<Assets<Image>>
// image_handle: &Handle<Image>
images.get_mut(image_handle.id());

doonv avatar Jan 14 '24 18:01 doonv

yup, that's triggering change detection on your image, and should not be needed

mockersf avatar Jan 14 '24 18:01 mockersf