Camera.current.screenPointToRay Query

So, I have two cameras. One is tagged as the MainCamera. And the other is untagged. The main Camera is looking at a submarine. And the untagged camera is looking at a drive station. The main Camera is rendering to Display 1 and the untagged camera is rendering to display 2. I want to click on some of the objects on the drive station so I use the code :

Ray ray = Camera.current.screenPointToRay(Input.mousePosition).

But when I play the game and switch to display 2 and start clicking on the drive station objects. The ScreenPointToRay(Input.mouseposition) throws nullreferenceexeption. So how to remove this error. Can we in unity have two main cameras?

hi, i have the same problem… did u resolve it ?