format
typescript
GameObject.GetComponent(type)class: GameObject
description
Get the component on the game object by specifying the type of the component.
parameter
| param_name | type | description |
|---|---|---|
| type | Component | The type of the component. |
reture
| type | description |
|---|---|
T|null | The component. |
code example
typescript
let go = new GameObject();
// Get the BoxCollider component on the game object
go.GetComponent(BoxCollider);