Description
Bevy version
0.15.0-rc.1
Further: I have verified via git bisect
that 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/lighting
example)
All three of those conditions are necessary to reproduce the bug
- Does not panic if
DirectionalLight
is replaced withPointLight
- Does not panic if shadows are disabled
- Does not panic if the Camera is removed
What went wrong
thread 'main' panicked at crates\bevy_pbr\src\render\light.rs:1265:18:
called `Option::unwrap()` on a `None` value
https://github.com/bevyengine/bevy/blob/v0.15.0-rc.1/crates/bevy_pbr/src/render/light.rs#L1265
This is a bare unwrap
with 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 expect
with 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.
Activity