bevy/crates/bevy_asset/src
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
..
io Replace bevy_log's tracing reexport with bevy_utils' (#12254) 2024-03-02 18:38:04 +00:00
processor Replace bevy_log's tracing reexport with bevy_utils' (#12254) 2024-03-02 18:38:04 +00:00
server bevy_utils: Add BuildHasher parameter to bevy_utils::Entry type alias (#12308) 2024-03-05 02:45:05 +00:00
assets.rs send Unused event when asset is actually unused (#12459) 2024-03-17 21:37:34 +00:00
direct_access_ext.rs Add methods to directly load assets from World (#12023) 2024-02-27 00:28:26 +00:00
event.rs Added AssetLoadFailedEvent, UntypedAssetLoadFailedEvent (#11369) 2024-01-17 21:12:00 +00:00
folder.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
handle.rs Disentangle bevy_utils/bevy_core's reexported dependencies (#12313) 2024-03-07 02:30:15 +00:00
id.rs Implement the AnimationGraph, allowing for multiple animations to be blended together. (#11989) 2024-03-07 20:22:42 +00:00
lib.rs Move AssetEvents to Last (#12389) 2024-03-09 21:15:02 +00:00
loader.rs Use Asset Path Extension for AssetLoader Disambiguation (#11644) 2024-02-12 15:44:55 +00:00
meta.rs Fix doc comment on AssetActionMinimal (#11105) 2024-03-11 18:59:27 +00:00
path.rs remove repetitive code (#12270) 2024-03-03 07:58:22 +00:00
reflect.rs Enable the unsafe_op_in_unsafe_fn lint (#11591) 2024-01-28 23:18:11 +00:00
saver.rs Fix AssetTransformer breaking LabeledAssets (#11626) 2024-02-02 14:57:31 +00:00
transformer.rs fix some typos (#12038) 2024-02-22 18:55:22 +00:00