Here is a playground where a sphere is created. Then VertexData for a box is created and applied to the source mesh. After this the index data for the submeshes are incorrect and clicking the box gives an error in the console.
Looking into the issue the submesh has the wrong indexStart and indexCount.
It works fine to do the same thing when instances are not involved.
Further investigation shows that while the source mesh has the subMeshes rebuild (with the new index count) the instances also have subMeshes (not sure why) and they are not updated.
I don’t quite get the subMesh situation but it seems that if a mesh understands that is has broken subMeshes so it needs to rebuild them… and it also has instances… then it should loop over the instances and do something That should be more or less free if there are no instances…
Just wanted to point out that this is not a bug that is important to us right now, it is just something I stumbled upon.
Summary: Geometry.setIndices fails to update subMesh information in InstancedMeshes causing corrupt index ranges there. Influences picking at least. Rendering is not affected since subMesh information is not used.