Init(args)
Scripting Reference
Loading...
Searching...
No Matches
Sisus.Init.Reflection.AddComponentExtensions Class Reference

Description

Extensions methods for UnityEngine.Object type classes that can be used to add components or clone objects while injecting values into fields and properties of the created instance using reflection.

This can make it easier to create unit tests for MonoBehaviour-derived classes as it allows one to set the values of non-public fields which in normal use-cases might be meant to only be assigned only through the inspector.

Static Public Member Functions

static TComponent AddComponent< TComponent > ([DisallowNull] this GameObject gameObject, [DisallowNull] params(string name, object value)[] arguments)
 Adds a component of type TComponent to the gameObject and initializes the component using the provided arguments .
 
static TComponent AddComponent< TComponent > ([DisallowNull] this GameObject gameObject, [DisallowNull] params object[] arguments)
 Adds a component of type TComponent to the gameObject and initializes the component using the provided arguments .