-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Panic with DirectionalLight+Shadows+Camera #16094
Copy link
Copy link
Open
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorP-RegressionFunctionality that used to work but no longer does. Add a test for this!Functionality that used to work but no longer does. Add a test for this!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorP-RegressionFunctionality that used to work but no longer does. Add a test for this!Functionality that used to work but no longer does. Add a test for this!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Bevy version
0.15.0-rc.1Further: I have verified via
git bisectthat this panic was introduced in de888a373de666ff9d1bbdf8275e7fb625584394 (#15554)(notable that this commit does not actually change the offending file, though perhaps that is the problem)
What I did
Add
DirectionalLight { shadows_enabled: true, ..default() }to an entity that has a Camera.(You may reproduce by simply adding that snippet when spawning the Camera in the regular
3d/lightingexample)All three of those conditions are necessary to reproduce the bug
DirectionalLightis replaced withPointLightWhat went wrong
https://github.com/bevyengine/bevy/blob/v0.15.0-rc.1/crates/bevy_pbr/src/render/light.rs#L1265
This is a bare
unwrapwith no comment indicating why it would be unreachable.Otoh, if it is supposed to be reachable (yet truly catastrophic), then it really ought to be an
expectwith similar justification in the text.Absent either of those, one has to trace back through the web of Components and Render World syncing to see why this condition could possibly arise (much less be justified in crashing the program when violated). If it's not clear, I'm on team 'no panic' :)
Additional information
Final note: This issue is not about whether a 'light on camera' setup does/should work (I was just messing around when I ran into this);
I'm only concerned about the fact that it panics.