AddComponent

public static Component AddComponent(GameObject gameObject, Type type) ;

Add component.

Parameter Name Description
gameObject GameObject
type Component type

Component

public static Type AddComponent<Type>(GameObject gameObject) ;

Add component.

Type Parameter Name Description Type Constraints
Type Component type
Parameter Name Description
gameObject GameObject

Component