Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

how to use CommandBuffer.DrawMeshInstancedIndirect draw submeshs

Discussion in 'Multiplayer' 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.