bevyengine / bevyengine/bevy

Attaching an AmbientLight to a Camera causes unexpected warning message

Open
#19,203 5 comments 1 reaction 0 assignees View on GitHub
A-Rendering C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

Bevy "0.16" via cargo

## \[Optional\] Relevant system information

cargo 1.86.0

Windows 11 Home 64 bit

AdapterInfo { name: "NVIDIA GeForce RTX 4070 SUPER", vendor: 4318, device: 10115, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "572.70", backend: Vulkan }

## What you did

Attached an `AmbientLight` component to an entity with a camera:

Cargo.toml
```
[package]
name = "ambient_light_issue"
version = "0.1.0"
edition = "2024"

[dependencies]
bevy = "0.16.0"
```

src/main.rs
```
use bevy::prelude::*;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup_camera)
.run();
}

fn setup_camera(mut commands: Commands) {
commands.spawn((Camera2d, Camera { ..default() }, AmbientLight::NONE));
}
```

(also works without the explicit `Camera` component, or with a Camera3d, etc.)

## What went wrong

Warning:
WARN bevy_render::camera::camera: Entity 3v1 has a `Camera` component, but it doesn't have a render graph configured. Consider adding a `Camera2d` or `Camera3d` component, or manually adding a `CameraRenderGraph` component if you need a custom render graph.

## Additional information

Removing the `AmbientLight` component fixes it. printing a list of entities with Camera components during Update, does not print 3v1, and 3v1 is not the id of the spawned entity with the light and camera

Contributor guide

Open the contributing guide

Research direction

Reproduce the warning with the minimal src/main.rs example, especially setup_camera and the Camera2d, Camera, and AmbientLight::NONE components. Trace the camera warning from the render-graph check and compare behavior when AmbientLight is removed. Done means the reported setup no longer emits the unexpected warning while valid camera configurations continue to warn appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.