unity add component

C#
//This uses C# and unity
//to add a ridgidbody
gameobject.addComponet<ridgidbody>();
//to add a meshCollider
gameobject.addComponet<MeshCollider>();
//check out my profile//to add a new ridgidbody
gameobject.AddComponent<Rigidbody>();
//to add a new meshCollider
gameobject.AddComponent<MeshCollider>();
//Original answer by MakerBenjammin6, cleanup by me.void Reset()
{
  //Your code here
}//Use the AddComponent<T>() Method to add a component to your gameobject
GameObject gameObject;

gameObject.AddComponent<BoxCollider>(); //Component has to be an actual Unity component
Source

Also in C#: