Mesh becomes invisible when camera moves out of specific bounds

I am creating a FOV system that prevents the player from looking past walls in 2D.

I have a gameObject with a Mesh Renderer and Mesh Filter on it.

The mesh works perfectly, except for one problem. When my camera moves out of a certain bounds, the mesh becomes invisible. Watch the attached clip to see what I mean.

The interesting thing about this is that the bounds relate to the camera size. For instance, my camera has size 6.75, and the mesh becomes invisible if the camera goes below -6.75 on the Y axis. It also becomes invisible when going above 26.75 on the Y axis. The mesh will also disappear when moving out of a certain bounds on the X axis, but I haven’t found out what the pattern is there yet.

If I adjust the camera size, the distance the camera can move until the mesh disappears directly changes.

Can anyone tell me why this is? I don’t think it is a problem with my code because the mesh is completely visible and normal in scene view. The problem has something to do with the camera.

Did you manage to find a solution to this problem? I’m having the same issue.

Edit: This was a really simple fix actually.

After you set up your mesh vertices, triangles, and uv via script, follow it with mesh.RecalculateBounds();