Init(args)
Scripting Reference

◆ AddComponent< TComponent >()

static TComponent Sisus.Init.Reflection.GameObjectExtensions.AddComponent< TComponent > ( this GameObject  gameObject,
params(string name, object value)[]  arguments 
)
static

Adds a component of type TComponent to the gameObject and initializes the component using the provided arguments .

Template Parameters
TComponentType of the component to add.
Parameters
gameObjectThe GameObject to which the component is added.
argumentsZero or more values to set.
Returns
The added component.
Exceptions
ArgumentNullExceptionThrown if this GameObject is null.
MissingMemberExceptionThrown if no field or property with one of the provided name names was found on the client class TComponent , or if a field or property was found but a value of type TValue is not assignable to it.
Type Constraints
TComponent :Component