Method GetRequiredComponent
- Namespace
- Gamelogic.Extensions
- Assembly
- Gamelogic.Extensions.dll
GetRequiredComponent<T>(Component)
Gets a component of the given type, or fail if no such component is attached to the given component.
public static T GetRequiredComponent<T>(this Component thisComponent) where T : Component
Parameters
thisComponent
ComponentThe component to check.
Returns
- T
A component of type T attached to the given component if it exists.
Type Parameters
T
The type of component to get.
Exceptions
- InvalidOperationException
When the no component of the required type exist on the given component.