-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Scenes do not hot reload #3759
Description
Using the hot reloading file watcher on a gltf scene with more than one mesh leads to unexpected results. The loading of the updated file seems to only partially replace the original one. Some of the original entity properties seem to persist between hot reloads.
Bevy version: 0.6
OS & graphic stack: ArchLinux kernel 5.16.2; mesa/vulkan-radeon lib: v21.3.4; GPU: AMD ATI Radeon RX 5600
Reproduction steps
- Replace the monkey scene at
assets/models/Monkey.gltfby thebevy-debug-scene-1.gltfscene I prepared - Run the bevy
hot_asset_reloadingexample - Replace
Monkey.gltfwithbevy-debug-scene-2.gltf. - Observe scene, pay attention to shape color and orientation
- Close the example and re-run it keeping
Monkey.gltfa copy ofbevy-debug-scene-2.gltf - Notice how the scene is now different from before you closed it (notably the color and rotation of meshes do not match)
files:
bevy-debug-scene-1.gltfbevy-debug-scene-2.gltf
I've updated my personal website, and now the scenes are gone. What you should try is swap between two scenes that have multiple entities.
Analysis
This was originally titled hot reloading of GLTF files with multiple meshes only works partially, however, after further investigation, it turns out that Scene simply never update.
The reason it seems to work in assets/hot_asset_reloading.rs is that the AssetLoader supports loading multiple asset types as "dependencies", typically when modifying the gltf, you'll modify the mesh and material, which will correctly update. However, scenes also describe the position of entities, which entities there are etc. Turns out this does not work at all. Bevy only implement scene hot reloading for DynamicScenes (as demonstrated in the scene/scene.rs example), not Scenes.