How to use functions like ScreenToRayPoint() in Camera class?
I have used this code:
Ray ray = camera.ScreenPointToRay(Input.mousePosition);
and it says
Component.camera is obsolete, instead using GetComponent()
Then I tried these:
Camera cam = GetComponent<Camera>();
Ray ray = cam.ScreenToRayPoint(Input.mousePosition);
and it says
Camera doesn't contain a definition of ScreenPointToRay and no extension method 'ScreenPointToRay' accepting a first argument of type 'Camera' could be found.