Skip to content

docs: picking requires RenderAssetUsages::MAIN_WORLD #19102

Open
@francisdb

Description

@francisdb

How can Bevy's documentation be improved?

I was creating meshes like this. (Got the code from some example I think)

let mut bevy_mesh = Mesh::new(
    PrimitiveTopology::TriangleList,
    RenderAssetUsages::RENDER_WORLD,
);
bevy_mesh.insert_attribute(Mesh::ATTRIBUTE_POSITION, positions);
...
commands
   .spawn((
        Name::new(primitive.name.to_string()),
        Mesh3d(meshes.add(bevy_mesh)),
        ...

Everything seemed to be rendered correctly but to my surprise picking was only working for bevy primitives and not for my meshes. After quite some searching I found out that I need to set the asset_usage to

RenderAssetUsages::MAIN_WORLD | RenderAssetUsages::RENDER_WORLD
// or
RenderAssetUsages::default()

to be able to pick the mesh.

Documenting that RenderAssetUsages::MAIN_WORLD requirement would have saved me a lot of time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-DocsAn addition or correction to our documentationS-Needs-TriageThis issue needs to be labelled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions