i cant understand this line of code

this is javascript

var wc : WheelCollider = go.AddComponent(typeof(WheelCollider)) as WheelCollider;

i dont know what does this line mean.

wc is variable.inherited WheelCollider. ok

go is GameObject i made and i know usage of AddComponent(). but this parameter is odd for me

help me and how can i translate this to C#?

Here’s the equivalent C# code (not tested). Hopefully this will help you start getting a feel for how C# compares to JS :slight_smile:

If you want to see the full breakdown of how to translate from JS to C#, visit What are the Syntax Differences in C# and Javascript? - Unity Answers

WheelCollider wc = go.AddComponent<WheelCollider>();

As cdrandin noted, in this case the ‘as WheelCollider’ isn’t necessary - you’ll usually only need to use this piece of code when finding components. FYI, the reason it isn’t necessary is because we’re using C# generics - here’s a link to more info: An Introduction to C# Generics | Microsoft Learn