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

◆ Init()

void Sisus.Init.IInitializable< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument >.Init ( TFirstArgument firstArgument,
TSecondArgument secondArgument,
TThirdArgument thirdArgument,
TFourthArgument fourthArgument,
TFifthArgument fifthArgument,
TSixthArgument sixthArgument )

Initializes the object with six objects that it depends on.

You can think of the Init method as a parameterized constructor alternative for Object-derived classes.

For classes that derive from MonoBehaviour<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument> Init gets called during the Awake event when the instance is being loaded at runtime and during the Reset event when the script is added to a GameObject in edit mode. If the GameObject is inactive causing the Awake event to never get fired, then the Init method is called immediately after the object has been created.

For classes that derive from ScriptableObject<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument> Init also gets called during the Awake event.

For other classes that implement IInitializable<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument> Init gets called automatically at the end of initialization (after Awake and OnEnable but before Start) when an instance is being created using InstantiateExtensions.Instantiate<TObject, TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument> or AddComponent.

It is also possible for the initialized object to retrieve the argument at any earlier stage of its initialization process, such as in the constructor or during the Awake event, using InitArgs.TryGet<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument>.

Parameters
firstArgumentFirst argument used during initialization of the component.
secondArgumentSecond argument used during initialization of the component.
thirdArgumentThird argument used during initialization of the component.
fourthArgumentFourth argument used during initialization of the component.
fifthArgumentFifth argument used during initialization of the component.
sixthArgumentSixth argument used during initialization of the component.

Implemented in Sisus.Init.MonoBehaviour< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument >, Sisus.Init.Requires< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument >, Sisus.Init.ScriptableObject< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument >, and Sisus.Init.StateMachineBehaviour< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument >.