Click or drag to resize

TransformExtensionsAddOrGetComponentT Method

Tries to get a component of type T, if none is found, one will be added

Namespace:  ImmerseSDK.Extensions
Assembly:  ImmerseSDK.App (in ImmerseSDK.App.dll) Version: 3.5.0.0 (3.5.0.0)
Syntax
C#
public static T AddOrGetComponent<T>(
	this UnityEngine.Transform transform
)
where T : UnityEngine.Component

Parameters

transform
Type: UnityEngine.Transform
Target transform

Type Parameters

T
Component type to add/get

Return Value

Type: T
Returns the existing/newly created component

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type UnityEngine.Transform. 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