Click or drag to resize

ExtensionMethodsCheckIfGameObjectHasComponentOfTypeT Method

Determines if a GameObject has at least one Component of a certain type already on it.

Namespace:  DustProductions.Core
Assembly:  DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public static bool CheckIfGameObjectHasComponentOfType<T>(
	this GameObject go
)
where T : Component

Parameters

go
Type: GameObject
The GameObject to search.

Type Parameters

T
The eype of Component you are looking for.

Return Value

Type: Boolean
True if there is at least one object of the type on the GameObject, 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