Yeah, I think that’s what’s happening, but it also seem to be the case that if I start with MeshCollider shared mesh and MeshFilter shared mesh set from the start, and I update the mesh data, this also triggers a rebake.
I can’t seem to find any way of updating a mesh without the collider auto-rebaking, but I want to bake manually in a job…
There must be a way otherwise Physics.bakeMesh wouldn’t exist lol
Some additional details, I’m updating the mesh with
mesh.SetVertexBufferParams(verts.Length, descriptors);
mesh.SetIndexBufferParams(indices.Length, IndexFormat.UInt16);
mesh.SetVertexBufferData(vertArray, 0, 0, vertArray.Length, stream: 0, meshUpdateFlags);
mesh.SetIndexBufferData(indexArray, 0, 0, indexArray.Length, meshUpdateFlags);
mesh.SetSubMesh(0, meshDescriptor, meshUpdateFlags);
I’ve tried
-keeping the meshfilter and meshcollider shared meshes assigned and updating the mesh
-setting meshfilter and meshcollider to null, baking mesh colliders, re-assigning submesh
-activating gameobject before assigning meshCollider shared mesh
-activating gameobject after assigning meshCollider shared mesh
They all result in the PhysX lag spack.
I should note that I’m not certain if this lag is unity baking the colliders, or doing something else…