Keep getting the Error: Camera' does not contain a definition for `mainCamera'

I have no clue why. Here’s the code corresponding with the error:

        Vector3 camPos = Camera.mainCamera.WorldToScreenPoint(transform.position);

Also I get the eroor: The name `CameraOperator’ does not exist in the current context

And here’s the code the corresponds with that error:

		camPos.y = CameraOperator.InvertMouseY(camPos.y);
		selected = CameraOperator.selection.Contains(camPos);

I had the same error. As it turns out, if one of your scripts is called Camera, it looks for Camera.main inside that script, instead of using the built-in Camera class. So either rename your Camera script, or add the UnityEngine namespace in front of your call:


Because you want to use: