-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Fix panic in update_viewport_render_target_size when despawning #22575
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
Conversation
alice-i-cecile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Panicking is not great, and I would like to avoid that!
This is a good non-breaking fix for 0.18.1, but I would be interested in a PR that swaps to an Option<Entity> for 0.19 in order to avoid this weird dangling state.
@alice-i-cecile correct me if I'm wrong but a Do relationships help here? I know that you can use them to auto-despawn linked entities, but in this case if the camera is despawned, does that mean we want to auto-despawn the entity with the Or, maybe this is just up to users to make sure they keep in sync themselves (if they care about dangling references here). |
|
So, changing this to an Instead, changing it to an My thought was that when the camera query fails, we set the value to We could instead swap |
chompaa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! i also agree with Alice's comments about switching to an Option for 0.19
|
@alice-i-cecile ah got it, thanks for clearing that up for me. Great, thanks @chompaa. I made an issue to track the enhancement: #22641 I don't plan on working on it at this stage (just FYI), for anyone casual observers who want to pick it up. |
Objective
ViewportNode.Msaa::Offto my camera causes a gray screen and it turns out it's related to my inspector egui camera. While trying to work out the cause, I was going through the egui inspector and despawning camera to see if it helped. While despawning one of my cameras which is referenced in aViewportNode, I got this panic due tounwrap()being used.Solution
unwrapbut just ignore the camera if it no longer exists. This can easily happen if the camera entity is despawned, e.g., usingDespawnOnExitstate, or manually despawned in an editor/inspector.ViewportNodeis left with a dangling/invalid reference. I'm not sure how to solve that though?Testing