Character Controller missing reference on almost any script.

I’ve been pulling my hair out with this problem. It’s happening for multiple scripts. The example I’ll use is because it is freely available to the public.

The errors I am getting are the following

Type CharacterController' does not contain a definition for velocity’ and no extension method velocity' of type CharacterController’ could be found (are you missing a using directive or an assembly reference?)

Note for this error, the error is in regards to CharacterController.velocity. In fact, anything that is trying to be called from CharacterController throws up the same errors, only replacing velocity for what it is trying to call.

I’ve tried deleting and re-importing the character controllers from the standard assets, and just installed unity 4.1.0f. All folders are in their default locations.

I was having this error on the previous version, and didn’t find a way around it, but the error was not bugging me as much then.

As an example for a script this happens to (there are many), see the following
I see no reason why it shouldn’t work, but for some reason it does not.


Anything trying to be accessed from the CharacterController throws up 'CharacterController does not contain a definition for ‘whatever it’s trying to access’

I’ve tried uninstalling, and reinstalling the following versions (3.5.6 || 4.0.0 || 4.0.1|| 4.1.0||) with no luck.

@bennyboy2321 solved the problem himself, but this is frequent enough to deserve an explanation: scripts are components, just like Rigidbody, CharacterController, Renderer etc. If one save a script as Renderer.js, for instance, it will hide the original Renderer component, causing lots of mysterious errors like the one above.

The hint is: whenever some standard and widely known component mysteriously disappears from Unity, look for some script innocently saved under the same name.

NOTE: Unity always complains when someone tries to save a script with the name of an Unity’s component, displaying a warning and a message like this in the console:

Script ‘Renderer’ has the same name as built-in Unity component.
AddComponent and GetComponent will not work with this script.