Init(args)
Scripting Reference

◆ Init() [5/5]

abstract void Sisus.Init.MonoBehaviour< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument >.Init ( TFirstArgument  firstArgument,
TSecondArgument  secondArgument,
TThirdArgument  thirdArgument,
TFourthArgument  fourthArgument,
TFifthArgument  fifthArgument 
)
protectedpure virtual

Provides the Component with the objects that it depends on.

You can think of the Init function as a parameterized constructor alternative for the component.

Init get called when the script is being loaded, before the OnAwake, OnEnable and Start events when the component is created using ObjectExtensions.Instantiate<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument> or GameObject.AddComponent{TComponent, TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument}.

In edit mode Init can also get called during the Reset event when the script is added to a GameObject, if the component has the InitOnResetAttribute or RequireComponent attribute for each argument.

Note that Init gets called immediately following object creation even if the GameObject to which the component was added is inactive unlike some other initialization event functions such as Awake and OnEnable.

Parameters
firstArgumentThe first object that this Component depends on.
secondArgumentThe second object that this Component depends on.
thirdArgumentThe third object that this Component depends on.
fourthArgumentThe fourth object that this Component depends on.
fifthArgumentThe fifth object that this Component depends on.

Implements Sisus.Init.IInitializable< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument >.