Screen space UI rays inaccurate

I’m using a screen space overlay canvas with various buttons and toggles, with the render camera set to the only camera in the scene which is in perspective mode. The scene is 3D. I have a movement script on the camera which allows it’s y position to be anywhere between 10 and 12000.

I’m experiencing an odd issue with the UI elements when the camera’s y position gets too high. At around 2500 the UI is inaccurate (e.g. I have to click some way to the left of a button to activate it). At heights over 5000 the UI is completely unresponsive (or possibly too inaccurate to get a hit?).

I’ve played around with all the settings in the canvas scaler script and graphic raycaster scripts to no effect. Altering the plane distance in the canvas makes no difference. The UI works fine in screen space overlay mode.

Thanks.

I figured out the problem eventually. If anyone else has this problem try increasing the near clipping plane on the camera.