Method GetComponent
GetComponent<T>()
Retrieves the component of Type T in the GameObject
Declaration
public T GetComponent<T>() where T : Component
Returns
Type | Description |
---|---|
T | The component if a component matching the type is found, null otherwise |
Type Parameters
Name | Description |
---|---|
T | The type of component to retrieve |
Remarks
This will take a dependency on the component
GetComponent<T>(Component)
Retrieves the component of Type T in the GameObject
Declaration
public T GetComponent<T>(Component component) where T : Component
Parameters
Type | Name | Description |
---|---|---|
Component | component | The Object to get the component from |
Returns
Type | Description |
---|---|
T | The component if a component matching the type is found, null otherwise |
Type Parameters
Name | Description |
---|---|
T | The type of component to retrieve |
Remarks
This will take a dependency on the component
GetComponent<T>(GameObject)
Retrieves the component of Type T in the GameObject
Declaration
public T GetComponent<T>(GameObject gameObject) where T : Component
Parameters
Type | Name | Description |
---|---|---|
GameObject | gameObject | The GameObject to get the component from |
Returns
Type | Description |
---|---|
T | The component if a component matching the type is found, null otherwise |
Type Parameters
Name | Description |
---|---|
T | The type of component to retrieve |
Remarks
This will take a dependency on the component