WeaverUtilities.

GetOrAddComponent<T>(GameObject) Method

Summary

Gets an instance of the specified component type on a game object or adds one if it doesn't have one.
Assembly
Weaver.dll
Namespace
Weaver
Containing Type
WeaverUtilities

Syntax

public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component

Type Parameters

Name Description
T The type of component to get.

Parameters

Name Type Description
gameObject GameObject The game object to get it from.

Return Value

Type Description
T The component that was found or added.