diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index 13991a23263a5..d939be0b593b1 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -641,7 +641,7 @@ pub fn prepare_lights( } let mut gpu_point_lights = [GpuPointLight::default(); MAX_POINT_LIGHTS]; - for (index, &(entity, light)) in point_lights.iter().enumerate() { + for (index, &(entity, light)) in point_lights.iter().enumerate().take(MAX_POINT_LIGHTS) { let mut flags = PointLightFlags::NONE; // Lights are sorted, shadow enabled lights are first if light.shadows_enabled && index < MAX_POINT_LIGHT_SHADOW_MAPS {