format
typescript
GameObject.DestroyComponent(com)class: GameObject
description
Remove a component from a game object.
parameter
| param_name | type | description |
|---|---|---|
| com | Component | The component object to be removed. |
return
| type | description |
|---|---|
void |
code example
typescript
let go = new GameObject();
// Add a BoxCollider component to the game object
let com = go.AddComponent<BoxCollider>(BoxCollider);
GameObject.DestroyComponent(com);