Did you set `controller` in the inspector?
Are you sure that the component's name is spelled exactly as you have it listed?
Double check that the component is attached to the object you're trying to access.
Finally, you might try moving that `GetComponent()` call into an `Awake()` function, like so:
var otherGuy : OtherGuyComponent;
function Awake()
{
otherGuy = GetComponent(OtherGuyComponent);
}
I personally don't recommend using GetComponent with string arguments. It works, but doesn't expose programming errors as early and only gives you generic "component" reference, which usually isn't ideal.
↧







