MissingComponentException - Not sure how to fix!

Trying to implement input into my game but getting this error in my console:

MissingComponentException: There is no ‘CharacterController’ attached to the ‘Main Camera’ game object, but a script is trying to access it

Game still runs as intended but console is in the background filling up rapidly with error messages. Not sure what the problem is as i have tried attaching a CharacterController to the main camera game object. Any help would be appreciated, :slight_smile:

// paste code here

You can make the Controller a [SerializeField] and set it in the Inspector.

Or you could make it so it searches for it with controller = FindObjectOfType<CharacterController>();

  • did you attached player script to your camera by mistake?
  • also check the camera script and make sure you save all you code opend in IDE

Hi, this issue has been fixed but i didn’t do anything that I’m aware of doing to fix it meaning that it probably just was something needed to save an carry over to my main project.