void MouseClick()
{
if (Input.GetMouseButtonDown(0))
{
Ray ray = Camera.current.ScreenPointToRay(Input.mousePosition);
print("aa");
if (Physics.Raycast(ray, out hit))
{}
}
}
The problem is that print is not executed, and the error is " reference to null " at the screenpointtoray.
If i change “current” to “main”, it works fine.
I only have one main camera in the scene, isnt current camera the same as main camera?
Are you sure you’re using the Camera.current exactly the same way in the other project? Since Camera.current is the “camera we are currently rendering with, for low-level render control only”, I don’t think you should use it to handle input. Use Camera.main or assign your script a reference to the correct camera.