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: (
public static bool CheckIfGameObjectHasComponentOfType<T>(
	this GameObject go
where T : Component


Type: GameObject
The GameObject to search.

Type Parameters

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