-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Asset will wrongly unload while strong handle is alive under certain circumstances #12344
Labels
Milestone
Comments
Litttlefish
added
C-Bug
An unexpected or incorrect behavior
S-Needs-Triage
This issue needs to be labelled
labels
Mar 6, 2024
TrialDragon
added
A-Assets
Load files from disk to use for things like images, models, and sounds
and removed
S-Needs-Triage
This issue needs to be labelled
labels
Mar 6, 2024
Addendum: So I'll rename this issue |
Litttlefish
changed the title
AssetServer won't load assets if the handle was unloaded in state change
Asset will wrongly unload while strong handle is active under certain circumstances
Mar 7, 2024
Litttlefish
changed the title
Asset will wrongly unload while strong handle is active under certain circumstances
Asset will wrongly unload while strong handle is alive under certain circumstances
Mar 7, 2024
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 17, 2024
# Objective fix #12344 ## Solution use existing machinery in track_assets to determine if the asset is unused before firing Asset::Unused event ~~most extract functions use `AssetEvent::Removed` to schedule deletion of render world resources. `RenderAssetPlugin` was using `AssetEvent::Unused` instead. `Unused` fires when the last strong handle is dropped, even if a new one is created. `Removed` only fires when a new one is not created. as far as i can see, `Unused` is the same as `Removed` except for this "feature", and that it also fires early if all handles for a loading asset are dropped (`Removed` fires after the loading completes). note that in that case, processing based on `Loaded` won't have been done anyway. i think we should get rid of `Unused` completely, it is not currently used anywhere (except here, previously) and i think using it is probably always a mistake. i also am not sure why we keep loading assets that have been dropped while loading, we should probably drop the loader task as well and remove immediately.~~
mockersf
pushed a commit
that referenced
this issue
Mar 18, 2024
fix #12344 use existing machinery in track_assets to determine if the asset is unused before firing Asset::Unused event ~~most extract functions use `AssetEvent::Removed` to schedule deletion of render world resources. `RenderAssetPlugin` was using `AssetEvent::Unused` instead. `Unused` fires when the last strong handle is dropped, even if a new one is created. `Removed` only fires when a new one is not created. as far as i can see, `Unused` is the same as `Removed` except for this "feature", and that it also fires early if all handles for a loading asset are dropped (`Removed` fires after the loading completes). note that in that case, processing based on `Loaded` won't have been done anyway. i think we should get rid of `Unused` completely, it is not currently used anywhere (except here, previously) and i think using it is probably always a mistake. i also am not sure why we keep loading assets that have been dropped while loading, we should probably drop the loader task as well and remove immediately.~~
Wabtey
added a commit
to Fabinistere/cats_destroyer_2000
that referenced
this issue
Aug 8, 2024
- prevent events handler/removalDetectors to crash by running `Commands::entity()` or `Query::get().unwrap()` after a level change - chain systems - FIXME: as issued [here](bevyengine/bevy#12344), the asset will wrongly unload while strong handle is alive after a State Change. It has been fixed in `13.1`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bevy version
0.13
What you did
In my tests the app has two states(A and B), and an entity with a sprite. when switching states, this entity will be despawned in
OnExit(State::A)
, and spawn a new one entity is identical to the prior one inOnEnter(State::B)
.What went wrong
When respawning it, the sprite will disappear(actually it is there, but the sprite is empty).
This didn't happen in 0.12 version.
Additional information
Here is my test code(need a custom image as
test.png
):After click state will switch, and the sprite entity will "disappear".
My assumption is that image asset unloaded the sprite in
OnExit(State::A)
, but it didn't load it again inOnEnter(State::B)
.The text was updated successfully, but these errors were encountered: