bevy
bevy copied to clipboard
Document practical differences between the two `HandleId` variants
Docs say HandleId::Id
is "a handle id of a loaded asset" while HandleId::AssetPathId
is "a handle id of a pending asset" but it is not immediately clear what this actually means, since a pending asset will presumably turn into a loaded asset at some point.
Here are a few questions I think it would be helpful for the documentation to answer:
- Under what conditions will the asset server return one vs the other?
- How is each used internally?
-
HandleId::Id
stores a type id, butHandleId::AssetPathId
does not. What are the implications of this? For instance,HandleUntyped::typed
claims to panic if the type is wrong but this is only true if its handle id is the former variant. - Why does
AssetServer::get_load_state
returnLoadState::NotLoaded
unconditionally if you give it what is ostensibly "the handle id of a loaded asset"?
Why does
AssetServer::get_load_state
returnLoadState::NotLoaded
unconditionally if you give it what is ostensibly "the handle id of a loaded asset"?
I think this is because of how Eq
is implemented for Handle
.
It just compares the HandleId
, which can be either HandleId::AssetPathId
or HandleId::Id
, so even if an id is supposed to point to the same asset it may not be considered equal :/
This type (or anything remotely resembling it AFAICT) no longer exists as of Assets v2.