Skip to content

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

Open
@uben0

Description

@uben0

Bevy version 0.16.0

System information

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.

#[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()),
));
fn delete_mesh3d(mut commands: Commands, marked: Single<Entity, With<Marked>>) {
    commands.entity(*marked).remove::<Mesh3d>();
}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorS-Needs-InvestigationThis issue requires detective work to figure out what's going wrong

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions