Hey, so I have a custom asset GobtonData that simply loads a ron file. I'd like to observe when it's done loading (or fails to do so). For this I have a system in Startup that:
- adds an observer on
Trigger<AssetLoadFailedEvent<GobtonData>>, logging and sendingAppExit::from_code(2) - adds an observer on
Trigger<AssetEvent<GobtonData>>, logging and sendingAppExitthat exits the app with a failure if the asset is still missing fromAssets<GobtonData>, or success if I get the asset. - loads the asset
The asset seems to load to, or to correctly fail when the file is missing or badly formatted (which confirm my custom asset loader is being used), but none of the observer run.
I noticed that when the asset fails to load, the error (from the asset loader) sometimes gets logged before, my info!("loading asset {}: {}, ...);, which makes me think there may be a race condition ? (I have bevy's default features).
I don't know where to go from there, are these events not supposed to be emitted in this situation ? Should I do like in bevy's custom asset examples and check if the event is loaded each frame ? I'd really like to react to events rather than actively poll.