bevyengine / bevyengine/bevy

StateScoped entity could cause "Could not despawn entity" warning

Open
#15,212 3 comments 0 reactions 0 assignees View on GitHub
A-States C-Bug D-Straightforward S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
4d 8m
Merged PRs (30d)
147

Description

## Bevy version

v0.14.2

## What you did

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.