You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spawned an entity with StateScoped(MyState) component and a children with StateScoped(MySubState) component.
What went wrong
If I exit MyState, both entities will first be despawned by StateScoped(MyState) (due to recursive despawn), and then the child entity will also be attempted to be despawned by StateScoped(MySubState). It causes warning:
WARN bevy_ecs::world: error[B0003]: Could not despawn entity because it doesn't exist in this World. See: https://bevyengine.org/learn/errors/#
I think that the warning shouldn't be emitted in this case.
The text was updated successfully, but these errors were encountered:
IMO the warning shouldn't be emitted in general, but I won't try to argue for that here. Some other options:
Add a try_despawn_recursive command that accepts that the entity may not exist when the command runs, so it doesn't warn.
Rebrand StateScoped as enum DespawnOnExit { Single, Descendants, Recursive } so it's more obvious that it does a recursive despawn and you only need to attach it to the root entity.
Make no change and consider this a user error, where they shouldn't be putting StateScoped on both parent and child.
Bevy version
v0.14.2
What you did
I spawned an entity with
StateScoped(MyState)
component and a children withStateScoped(MySubState)
component.What went wrong
If I exit
MyState
, both entities will first be despawned byStateScoped(MyState)
(due to recursive despawn), and then the child entity will also be attempted to be despawned byStateScoped(MySubState)
. It causes warning:I think that the warning shouldn't be emitted in this case.
The text was updated successfully, but these errors were encountered: