I am creating a FOV system that prevents the player from looking past walls in 2D.
I have a gameObject with a MeshRenderer 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.
https://streamable.com/hzz0by
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.