Method AddComponent
AddComponent<T>(GameObject)
Adds a component to the game object and registers an undo operation for this action.
Declaration
public T AddComponent<T>(GameObject gameObject) where T : Component
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | gameObject | The game object you want to add the component to. |
Returns
| Type | Description |
|---|---|
| T | The new component. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of component you want to add. |