bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
34.72k stars 3.39k forks source link

Hot Reloading does not work with texture images #8341

Open tylerkayser opened 1 year ago

tylerkayser commented 1 year ago

Bevy version

main branch 0d971a63e4ff86aa416240c6684b2d7a1a4fa0c9

Relevant system information

MacOS Ventura 13.1, M1 MacBook

What you did

I modified the hot_asset_reloading example to simulate my problem:

-fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
-    // Load our mesh:
-    let scene_handle = asset_server.load("models/monkey/Monkey.gltf#Scene0");
+fn setup(
+    mut commands: Commands,
+    mut meshes: ResMut<Assets<Mesh>>,
+    mut materials: ResMut<Assets<StandardMaterial>>,
+    asset_server: Res<AssetServer>,
+) {
+    // Load our texture:
+    let texture_handle: Handle<Image> = asset_server.load("textures/array_texture.png");

-    commands.spawn(SceneBundle {
-        scene: scene_handle,
+    // plane
+    commands.spawn(PbrBundle {
+        mesh: meshes.add(Mesh::try_from(shape::Plane::from_size(10.)).unwrap()),
+        material: materials.add(StandardMaterial {
+            base_color_texture: Some(texture_handle),
+            ..default()
+        }),

What went wrong

I expected the plane's material to hot reload when the texture file was changed.

Additional information

Scene and model files hot reload as intended.

772 commented 1 year ago

I can confirm this, using bevy 0.10. I just wondered why my textures and normal maps aren't updating. A fix or workaround would be appreciated. :)

Edit: Still in bevy 0.11. But I have been told that Asset V2 (PR #8624) may fix this.

Pnoenix commented 1 week ago

@772 If you are still working on your project, is this still an issue in 0.14.1 or 0.14.0, if you have updated to one of these versions?