remove component from gameobject in script code example
Example 1: how to remove a component from an object in unity
Destroy(GetComponent());
Example 2: unity remove component in script
Destroy (gameObject);
Destroy(GetComponent());
Destroy (gameObject);