 | ExtensionMethodsTryGetComponentsT Method (Component, T, Boolean) |
Attempts to get components on a gameobject.
Namespace:
DustProductions.Core
Assembly:
DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntaxpublic static bool TryGetComponents<T>(
this Component component,
ref T[] refComponentArray,
bool tryAddingComponent = false
)
where T : Component
Parameters
- component
- Type: Component
The component on the gameobject you are searching - refComponentArray
- Type: T
A reference to the array of components found, if one is found - tryAddingComponent (Optional)
- Type: SystemBoolean
>Optional parameter to attempt adding the component if it cannot be found, defaulted to false
Type Parameters
- T
- The type of component you are looking for
Return Value
Type:
BooleanTrue if a component is found (either in the component array passed in, or on the object being searched) or successfully added
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
Component. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also