-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
C-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelledThis issue needs to be labelled
Description
Bevy version
main, 0.15.0-dev.
introduced in bc34216 by #14257
The same mesh is used even though there are two different custom meshes added. Each time the program runs, one of the two meshes is selected and used for both renders.
The previous commit 293e915 does not show the bug.
What you did
The following program adds two different custom 2d meshes.
use bevy::{
prelude::*,
render::{
mesh::PrimitiveTopology,
render_asset::RenderAssetUsages,
},
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, spawn_custom_meshes)
.run();
}
pub fn spawn_custom_meshes(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
commands.spawn(Camera2dBundle::default());
let mesh_1 = Mesh::new(
PrimitiveTopology::TriangleList,
RenderAssetUsages::RENDER_WORLD,
)
.with_inserted_attribute(
Mesh::ATTRIBUTE_POSITION,
vec![
[50., 0., 0.],
[-50., 0., 0.],
[0., 100., 0.],
[50., 0., 0.],
],
);
commands.spawn(MaterialMesh2dBundle {
mesh: Mesh2dHandle(meshes.add(mesh_1)),
material: materials.add(ColorMaterial {
color: Color::linear_rgb(0., 1., 0.),
..Default::default()
}),
transform: Transform::from_xyz(-50., 0., 0.),
..default()
});
let mesh_2 = Mesh::new(
PrimitiveTopology::TriangleList,
RenderAssetUsages::RENDER_WORLD,
)
.with_inserted_attribute(
Mesh::ATTRIBUTE_POSITION,
vec![
[-50., 50., 0.],
[50., 50., 0.],
[0., -50., 0.],
[-50., 50., 0.],
],
);
commands.spawn(MaterialMesh2dBundle {
mesh: Mesh2dHandle(meshes.add(mesh_2)),
material: materials.add(ColorMaterial {
color: Color::linear_rgb(0., 0., 1.),
..Default::default()
}),
transform: Transform::from_xyz(50., 0., 0.),
..default()
});
}
Here's a cargo.toml for ease of replication
[package]
name = "meshes"
version = "0.1.0"
edition = "2021"
[dependencies]
# main
bevy = { git = "https://github.com/bevyengine/bevy.git" }
## has bug
# bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "bc342169293187cb1e9b59bb0f6a0872f457b5d1" }
## prior commit, no bug
# bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "293e91564b20dc2971e47c79e727f7db2349024c" }Additional information
There were some updates to the 3d pipeline to fix example regressions. Item 2 in #14375 might be relevant.
Metadata
Metadata
Assignees
Labels
C-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelledThis issue needs to be labelled


