- Home /
'Camera' does not contain a definition for 'ScreenPointToRay'
Hi, I want to make my player face the mouse pointer. (Twin stick shooter like) After some failed tries, I googled, found this.
Now I "translated" it to C#, but I always get the error 'Camera' does not contain a definition for 'ScreenPointToRay'
Code: Ray myRay = Cam.ScreenPointToRay(Input.mousePosition); // cam is defined as "public Camera cam;" and a camera is assigned in unity
Why is that? How can I fix it?
Answer by robertbu · Dec 05, 2014 at 03:29 PM
Any chance you named one of your scripts 'Camera'? If so, your script is overriding Unity's Camera class.
Your answer
Follow this Question
Related Questions
Screen.lockCursor messes my rotation 1 Answer
Why won't my player rotation script work? 0 Answers
Cursor disappears in unity. 1 Answer
Flight Sim Mouselook 1 Answer
Rotate to mouse cursor error 1 Answer