format
typescript
Component.gameObjectclass: Component
description
(Read Only) The game object to which the current component is attached.
A game object is the basic building block in a scene, while a component is a functional module of a game object that contains its behavior and properties.
parameter
| param_name | type | description |
|---|
reture
| type | description |
|---|---|
GameObject | The game object. |
code example
typescript
let go = new GameObject();
// Add a BoxCollider component to the game object
let com = go.AddComponent<BoxCollider>(BoxCollider);
com.gameObject;