C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,280 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
d
Is there a reason you're using the non-generic version of GetComponent
?
Assuming that your CarController
class has an enabled
property, presumably if you specify it as the type argument then the object returned from GetComponent
should be CarController
, i.e:
CarControl.GetComponent<CarController>().enabled = true;
Does this resolve your compiler error? Also you can see what your compiler error in the "Error List" tab panel at the bottom of Visual Studio: