Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid panic with parented scenes on deleted entities #8512

Merged
merged 3 commits into from
May 1, 2023

Conversation

robtfm
Copy link
Contributor

@robtfm robtfm commented Apr 29, 2023

Objective

after calling SceneSpawner::spawn_as_child, the scene spawner system will always try to attach the scene instance to the parent once it is loaded, even if the parent has been deleted, causing a panic.

Solution

check if the parent is still alive, and don't spawn the scene instance if not.

@robtfm robtfm added C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash A-Scenes Serialized ECS data stored on the disk labels Apr 29, 2023
@mockersf
Copy link
Member

mockersf commented Apr 29, 2023

This seems not the best fix for me as it means we still spawn the scene and one frame after despawn it.

To avoid that, a check could be added in this system: https:/bevyengine/bevy/blob/main/crates/bevy_scene/src/scene_spawner.rs#L317

@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 1, 2023
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label May 1, 2023
Merged via the queue into bevyengine:main with commit deba380 May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Scenes Serialized ECS data stored on the disk C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants