Relevant official examples:
At runtime, if you modify the file of an asset that is loaded
into the game (via the
AssetServer), Bevy can detect
that and reload the asset automatically. This is very useful for quick
iteration. You can edit your assets while the game is running and see the
changes instantly in-game.
Not all file formats and use cases are supported equally well. Typical asset types like textures / images should work without issues, but complex GLTF or scene files, or assets involving custom logic, might not.
Hot reloading is opt-in and has to be enabled in order to work. You can do this in a startup system:
Note that this requires the
filesystem_watcher Bevy cargo
feature. It is enabled by default, but if you have disabled
default features to customize Bevy, be sure to include it if you need it.
Bevy also supports hot-reloading for shaders. You can edit your custom shader code and see the changes immediately.
This only works if you are loading your shaders through the bevy asset
system (via the
Shader code that does not come from asset files, such as if you include it as a static string in your source code, cannot be hot-reloaded.