//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