- Home /
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 http://wiki.unity3d.com/index.php/FootstepHandler I see no reason why it shouldn't work, but for some reason it does not.
TL;DR
Anything trying to be accessed from the CharacterController throws up 'CharacterController does not contain a definition for 'whatever it's trying to access'
Update; I've tried uninstalling, and reinstalling the following versions (3.5.6 || 4.0.0 || 4.0.1|| 4.1.0||) with no luck.
Could you by any chance, upload some of your own code? Or are you directly copying the code from the FootstepHandler example?
Thanks for the reply Pingo, I actually solved it, and it was a rather embarrassingly-simple solution.
Some time ago, I had a script called CharacterController. Named exactly the same as the component. It was trying to call up all of these things from the scrip I had, where they of course didn't exist. At the time I made the script, I was unaware it would cause conflict, and while I was trying to solve this conflict, I had completely forgotten about the script.
So all is now good :) Still, thanks for taking your time to help look into it.
Answer by aldonaletto · Mar 21, 2013 at 11:32 PM
@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.
I had just added assets from the store. This solved my problem, thank you.
Your answer
![](https://koobas.hobune.stream/wayback/20220613094819im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The referenced script on this Behaviour is missing please help. 2 Answers
Method reference dropping from OnClick() 1 Answer
why does character controller accelerate off ledges? 1 Answer
CharacterController.Move() is causing unwanted vertical movement . . . how to fix? 2 Answers
Character controller problem 2 Answers