bevy/crates/bevy_asset
robtfm 36cfb2170f
send Unused event when asset is actually unused (#12459)
# 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.~~
2024-03-17 21:37:34 +00:00
..
macros Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
src send Unused event when asset is actually unused (#12459) 2024-03-17 21:37:34 +00:00
Cargo.toml Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00