unity delete component code example
Example 1: how to remove a component from an object in unity
Destroy(GetComponent<TheComponentYouWantToDestroy>());
Example 2: delete in unity
Destroy(GameObject obj);
Example 3: unity remove component in script
Destroy (gameObject);
Example 4: unity3d remove component
Destroy (gameObject);
Destroy (this);
Destroy (rigidbody);
Destroy (gameObject, 5);
function Update () {
if (Input.GetButton ("Fire1") && GetComponent (FooScript))
Destroy (GetComponent (FooScript));
}