Meshcollider doesn't update

I have a procedurally generated mesh, it looks like this:
I want to check, if there’s a hole in front of the camera, but when I raycast, it detects the holes in the same height as a surface (-1 instead of -2 to be precise). I looked at it in scene view, and it looks like the meshcollider is ok, but when I update it (by checking and unchecking convex on the collider) it detects the holes on the correct height. Did I forgot something? Is there any way to update a meshcollider via script?

2298093--154648--1.png

It’s an old bug, try setting the mesh of the meshcollider to null before assigning the new mesh.

Yeah, that solution is already gone, I’m now deleting and addign the component