| ReflectionUtilitiesTryAddWrapperComponentFromAssemblyUsingReflectionT Method |
Searches the Assembly-CSharp.dll using reflection for the type of Component passed in, then adds it to the GameObject. This method can be pretty slow, so I wouldn't use it in anything critical.
Namespace:
DustProductions.Core
Assembly:
DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static bool TryAddWrapperComponentFromAssemblyUsingReflection<T>(
this GameObject gameObject,
out T addedComponent,
Type typeToAdd = null
)
where T : Component
Parameters
- gameObject
- Type: GameObject
The object to add the component to. - addedComponent
- Type: T
The FIRST found Component in the assembly that was added successfully. - typeToAdd (Optional)
- Type: SystemType
Optional parameter to pass in the Type of Wrapper Component to search for, if we know it ahead of time.
Type Parameters
- T
- The type of the object to add.
Return Value
Type:
BooleanTrue if the Component is found and added successfully, false otherwise
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
GameObject. 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