ScreenPointToRay Method Not Working

So im trying to use the the method ScreenPointToRay but i get the error Camera does not contain definition for ScreenPointToRay i tried with the main camera like
Ray ray = Camera.main.ScreenPointToRay(transform.position);
and i tried using a custom one just to see which one will work
Ray ray = cam.ScreenPointToRay(transform.position);
And its just really weird I tried it on a different project to see what s this all about and it worked so im confused on whats the problem with this simple method.
If you need more information Ill try to provide .
Thanks in advance

You haven’t provided the exact errors for your two usecases. However, could it be that you created a class called “Camera” which is hiding / replacing the type UntiyEngine.Camera? Avoid naming your own types the same as common built-in types.