Init(args)
Scripting Reference
Loading...
Searching...
No Matches

◆ Init() [1/2]

void Sisus.Init.MonoBehaviour< TArgument >.Init ( TArgument argument)
abstractprotected

Provides the Component with the argument object that it depends on.

You can think of the Init method 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 InstantiateExtensions.Instantiate<TArgument> or AddComponent.

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
argumentObject that this component depends on.

Implements Sisus.Init.IInitializable< TArgument >.