Path: blob/main/release-content/migration-guides/handle_weak_replaced_with_handle_uuid.md
6592 views
---
---
Handle::Weak
had some weird behavior. It allowed for a sprite to be given a handle that is dropped while the sprite is still using it. This also resulted in more complexity in the asset system. The primary remaining use for Handle::Weak
is to store asset UUIDs initialized through the weak_handle!
macro. To address this, Handle::Weak
has been replaced by Handle::Uuid
!
Users using the weak_handle!
macro should switch to the uuid_handle!
macro.
Users using Handle::clone_weak
can (most likely) just call Handle::clone
instead.
Users using the Handle::Weak
variant directly should consider replacing it with AssetId
instead, accessible through Handle::id
. These situations are very case-by-case migrations.
P.S., for users of the weak_handle!
macro: If you are using it for shaders, consider switching to load_shader_library
/load_embedded_asset
instead (especially replacing load_internal_asset
). This enables hot reloading for your shaders - which Bevy internally has done this cycle!