bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.36k stars 3.49k forks source link

Remove `LoadedAsset::meta` #15485

Open andriyDev opened 4 hours ago

andriyDev commented 4 hours ago

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

This field is (nearly) unused, and inaccessible. It adds more conceptual overload for no advantage.

What solution would you like?

Delete the field!

Additional context

This may be planned feature work, but I don't think so. Subassets having metadata doesn't make much sense as far as I can tell, and the root asset has its metadata passed in and it isn't changed. The only part that's a little confusing is the populate_hashes argument, but that only affects the loader dependencies, not the asset's meta field.

moOsama76 commented 3 hours ago

what about being used here for hashing? https://github.com/moOsama76/bevy/blob/6963b58eba4fa7d8cc73389f57699ed31a8216d4/crates/bevy_asset/src/loader.rs#L542

andriyDev commented 3 hours ago

what about this variable using it?

This doesn't seem to be linking to anything meta related? Not sure if I'm misunderstanding

what about being used here for hashing?

That meta usage is the same Box<dyn AssetMetaDyn> that gets passed in to the loader. So instead of computing the hash based on the meta from the loaded asset, we can just store the hash based on the meta we pass in. As far as I can tell, there's no way for us to change the meta, so there's no way for the hash to be different.

moOsama76 commented 3 hours ago

I think you are correct