Click or drag to resize

ExtensionMethodsTryGetRootParentTypeT Method

Attempts to get the uppermost type of an object in a GameObject tree.

Namespace:  DustProductions.Core
Assembly:  DustProductions.Core (in DustProductions.Core.dll) Version: (
public static bool TryGetRootParentType<T>(
	this Transform transform,
	out T outType
where T : Component


Type: Transform
The starting point of the search
Type: T
The uppermost object of that type

Type Parameters

the type of object you are looking for

Return Value

Type: Boolean
True if an object is found

Usage Note

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