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?
Your answer
Follow this Question
Related Questions
Why is my camera shaking when I use my chaser script on something? 0 Answers
Camera follow target glitches 1 Answer
Render to minimap on command 1 Answer
How to tell if a looked at object has a text mesh. 0 Answers
Help in making a video camera 1 Answer