Bevy version and features
Bevy 0.19.0, default features.
What you did
Create a new Mesh without adding any vertices/indices etc. and spawned an entity using that mesh.
What went wrong
After spawning the entity the following error is logged:
ERROR bevy_render::slab_allocator: Use-after-free: attempted to copy element data for an unallocated key
The error message does not match what is actually happening and results in confusion.
Perhaps a warning or error sooner in the process the points to mesh being empty, assuming empty meshes are not a supported feature.
Steps to reproduce
Add this system to the startup schedule:
fn test(mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<StandardMaterial>>, mut commands: Commands)
{
let m = Mesh::new(
bevy::mesh::PrimitiveTopology::TriangleList,
RenderAssetUsages::RENDER_WORLD,
);
let handle = meshes.add(m);
commands.spawn((
Mesh3d(handle),
MeshMaterial3d(materials.add(Color::WHITE)),
Transform::default(),
));
}
Bevy version and features
Bevy 0.19.0, default features.
What you did
Create a new Mesh without adding any vertices/indices etc. and spawned an entity using that mesh.
What went wrong
After spawning the entity the following error is logged:
The error message does not match what is actually happening and results in confusion.
Perhaps a warning or error sooner in the process the points to mesh being empty, assuming empty meshes are not a supported feature.
Steps to reproduce
Add this system to the startup schedule: