Click or drag to resize

GameObjectExtensionsGetTopMostComponentT Method (GameObject, FuncT, Boolean)

Traverses the gameObject hierarchy upwards (via parents) to find the topmost instance of the script

Namespace:  ImmerseSDK.Extensions
Assembly:  ImmerseSDK.App (in ImmerseSDK.App.dll) Version: 3.9.0.0 (3.9.0.0)
Syntax
C#
public static T GetTopMostComponent<T>(
	this UnityEngine.GameObject go,
	Func<T, bool> picker
)
where T : class

Parameters

go
Type: UnityEngine.GameObject
picker
Type: SystemFuncT, Boolean
A Picker function that returns true if the component is valid, otherwise false

Type Parameters

T

Return Value

Type: T

Usage Note

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