GameObjectExtensions.GetRequiredComponent<T>
Extension Method in GameObjectExtensions
Declaration
public static T GetRequiredComponent<T>(this GameObject gameObject)
where T : ComponentDescription
Gets the specified component from the game object. If the component does not exist then it will be added to the game object.
Type Parameters
| T | The type of component to get. |
Parameters
| gameObject | The game object to get the component from. |
Returns
| T | The component. |