need help with c# what is wrong?

Luca Buschholtz 0 Reputation points
2023-06-10T22:54:01.2966667+00:00

dScreenshot 2023-06-10 232432

C#
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
{count} votes

1 answer

Sort by: Most helpful
  1. P a u l 10,406 Reputation points
    2023-06-11T12:59:44.67+00:00

    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:

    User's image

    1 person found this answer helpful.
    0 comments No comments