File watcher should be more selective

Open
#26,572 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
game-dev, tooling

Research direction

Read the discussion in #26407 and trace Bevy’s asset server file-watching path. The issue suggests filtering reloads by asset type or file path, or skipping reloads caused by the app itself, but does not name files or tests. Done means an editor can opt out of watching selected assets; first clarify which approach and behavior the project wants.

Written by the indexing model from the issue text.

Description

A-Assets C-Usability D-Modest S-Needs-Design

What problem does this solve or what need does it fill?

When writing an editor in Bevy, file watching can sometimes hurt more than it helps.

As a general rule, apps which are the sole source of truth for a file don't need the file system to tell them when something changed, they already know it. Worse, having to respond to a reload request for a file that they just themselves saved requires complex logic, since (to avoid flicker) they have to diff the incoming file with their own in-memory copy - since a full reload of the asset would require rebuilding derived data and restart animations.

This logic does not apply to assets that are coming from another app, e.g. models exported from blender where hot reloading is a clear win.

The question is what counts as a "sole source". Any asset might be replaced by a git sync; some asset types might also be editable in a text editor. However, not every editor will want to support this workflow: they would rather advise the user to quit the editor when pulling down new content from git rather than deal with the complexity of having to filter out it's own save events, or suffer the visual glitchiness of not doing so.

Currently Bevy's file watcher is all or nothing, so an editor has no choice about which files they want to watch.

What solution would you like?

There are a couple of potential solutions. The ideal would be for the asset server to skip reloads coming from the app itself; but this might be hard to arrange.

An easier approach would be the ability to opt-out of file watching on the basis of asset type or file path.

Additional context

See also #26407

@alice-i-cecile @andriyDev @jbuehler23

Dominant language
Rust
Stars
49.8k
Forks
5.1k
Avg merge
3d 4h
Merged PRs (30d)
136

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bevyengine/bevy

All issues in bevyengine/bevy

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.