bevyengine / bevyengine/bevy

Removing Mesh3d but keeping MeshMaterial3d stops material from rendering for all entities using it.

Open
#19,804 1 comment 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

Bevy version 0.16.0

System information

```ignore
AdapterInfo { name: "AMD Radeon Graphics (RADV RENOIR)", vendor: 4098, device: 5708, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 25.1.4", backend: Vulkan }
```

## Step to reproduce

Use a same material for different entities with `Mesh3d`. Then remove the `Mesh3d` component from one of them.

```rust
#[derive(Component)]
struct Marked;

commands.spawn((
Transform::default(),
Mesh3d(sphere.clone()),
MeshMaterial3d(material.clone()),
));
commands.spawn((
Marked,
Transform::default(),
Mesh3d(sphere.clone()),
MeshMaterial3d(material.clone()),
));
```

```rust
fn delete_mesh3d(mut commands: Commands, marked: Single>) {
commands.entity(*marked).remove::();
}
```

## Expected behavior

The entity whose `Mesh3d` was removed, no longer renders. All the others still do and no warning is raised.

## Actual behavior

Most entities sharing the same material as the entity whose `Mesh3d` was removed, stop being rendered. No warning nor error is reported. Not all entities are affected and the behavior seems to not be deterministic.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.