Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose watch_for_changes again #11490

Closed
janhohenheim opened this issue Jan 23, 2024 · 1 comment · Fixed by #11578
Closed

Expose watch_for_changes again #11490

janhohenheim opened this issue Jan 23, 2024 · 1 comment · Fixed by #11578
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@janhohenheim
Copy link
Member

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

Bevy 0.12 removed AssetPlugin::watch_for_changes. We now have the ability to set the watcher activity via a feature or override it. If we don't override it, there is currently no way for a plugin to read whether we are in hot-reloading mode or not. My plugin however would like to know this, since I modify some resources on disk. If hot reloading is not enabled, my plugin needs to sync the in-memory resources as well, since they will not be automatically reloaded.

What solution would you like?

Expose a boolean somewhere that tells us whether hot reloading is on or off.

What alternative(s) have you considered?

Just don't. In my case, my plugin could just force the user to activate hot reloading on supported platforms.

Additional context

This came up while updating Yarn Slinger to Bevy 0.12

@janhohenheim janhohenheim added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 23, 2024
@Kanabenki Kanabenki added A-Assets Load files from disk to use for things like images, models, and sounds C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 23, 2024
github-merge-queue bot pushed a commit that referenced this issue Jan 28, 2024
# Objective

- Closes #11490.
- Allow retrieving the current asset watch behavior from the
`AssetServer`.

## Solution

- Add the corresponding getter. (also fixes some trailing whitespace).

A corresponding helper could also be added on the `AssetPlugin` struct
(returning `self.watch_for_changes_override.unwrap_or(cfg!(feature =
"watch"))`), but it seems it isn't a current practice to have actual
methods on the plugin structs appart from the `Plugin` impl.

---

## Changelog

### Added

Added `watching_for_changes` getter on `AssetServer`.

---------

Co-authored-by: Mateusz Wachowiak <[email protected]>
@janhohenheim
Copy link
Member Author

Thanks @Kanabenki ❤️

tjamaan pushed a commit to tjamaan/bevy that referenced this issue Feb 6, 2024
…1578)

# Objective

- Closes bevyengine#11490.
- Allow retrieving the current asset watch behavior from the
`AssetServer`.

## Solution

- Add the corresponding getter. (also fixes some trailing whitespace).

A corresponding helper could also be added on the `AssetPlugin` struct
(returning `self.watch_for_changes_override.unwrap_or(cfg!(feature =
"watch"))`), but it seems it isn't a current practice to have actual
methods on the plugin structs appart from the `Plugin` impl.

---

## Changelog

### Added

Added `watching_for_changes` getter on `AssetServer`.

---------

Co-authored-by: Mateusz Wachowiak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants