Goober.Unity @script

I was trying the Goober.Unity example and after reading the code I realized that there is a line with the following code :

@script RequireComponent(CharacterController)

I dont understand this piece of code. When I commented it , the application worked without problems. Thanks

HTWarrior

That line is a declaration that says “this component requires the charactercontroller to be on the same game object”. If that is there, Unity will make sure it is the case (e.g. adding the CharacterController to the game object automatically when you add the goober script"

I could add that now that we have search in the docs, most of these questions can be answered easily. See that line you don’t understand? Search for RequireComponent and that often gives some insights.

Thanks, I will try this new funtionality.