Search Unity

Question how to use CommandBuffer.DrawMeshInstancedIndirect draw submeshs

Discussion in 'Universal Render Pipeline' started by tonyqiu, May 30, 2023.

  1. tonyqiu

    tonyqiu

    Joined:
    May 29, 2019
    Posts:
    2
    a model has two submeshs . i build a bufferWithArgs like this : 444,20,0,0,0,2688,20,444,0,0, and draw it with argsOffset
    code like this:
    for (int i = 0; i < render.mesh.subMeshCount; i++)
    {
    cmd.DrawMeshInstancedIndirect(render.mesh, i, render.material, 0, render.argsBuffer, i * 5, render.blocks);
    }
    but only draw 1 submesh in game scene. so how do i fix it? thanks.