Skip to content

Scenes do not hot reload #3759

@nicopap

Description

@nicopap

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.gltf by the bevy-debug-scene-1.gltf scene I prepared
  • Run the bevy hot_asset_reloading example
  • Replace Monkey.gltf with bevy-debug-scene-2.gltf.
  • Observe scene, pay attention to shape color and orientation
  • Close the example and re-run it keeping Monkey.gltf a copy of bevy-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.gltf
  • bevy-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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AssetsLoad files from disk to use for things like images, models, and soundsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions