Init(args)
Scripting Reference
Loading...
Searching...
No Matches
Sisus.Init.MonoBehaviour< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument > Class Template Referenceabstract

Description

A base class for MonoBehaviours that can be instantiated or added to a GameObject with nine arguments passed to the Init method of the created instance.

If the object depends exclusively on objects that have been registered as services using the ServiceAttribute, then it will be able to receive the services in its Init method automatically during its initialization.

If the component is part of a scene or a prefab, add depends on any classes that don't have the ServiceAttribute, then an Initializer<TComponent, TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument> can be used to specify its initialization arguments.

Instances of classes inheriting from MonoBehaviour<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument> receive the arguments via the Init method where they can be assigned to member fields or properties.

Template Parameters
TFirstArgumentType of the first argument received in the Init method.
TSecondArgumentType of the second argument received in the Init method.
TThirdArgumentType of the third argument received in the Init method.
TFourthArgumentType of the fourth argument received in the Init method.
TFifthArgumentType of the fifth argument received in the Init method.
TSixthArgumentType of the sixth argument received in the Init method.
TSeventhArgumentType of the seventh argument received in the Init method.
TEighthArgumentType of the eighth argument received in the Init method.
TNinthArgumentType of the ninth argument received in the Init method.
Inheritance diagram for Sisus.Init.MonoBehaviour< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument >:
Sisus.Init.MonoBehaviourBase Sisus.Init.IInitializable< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument > Sisus.Init.IInitializable Sisus.Init.IArgs< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument > Sisus.Init.INinthArgument< TNinthArgument > Sisus.Init.IEighthArgument< TEighthArgument > Sisus.Init.ISeventhArgument< TSeventhArgument > Sisus.Init.ISixthArgument< TSixthArgument > Sisus.Init.IFifthArgument< TFifthArgument > Sisus.Init.IFourthArgument< TFourthArgument > Sisus.Init.IThirdArgument< TThirdArgument > Sisus.Init.ISecondArgument< TSecondArgument > Sisus.Init.IFirstArgument< TFirstArgument > Sisus.Init.INineArguments

Protected Member Functions

void Init (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument, TNinthArgument ninthArgument)
 Provides the Component with the objects that it depends on.
 
virtual void OnReset ()
 Reset state to default values.
 
override bool Init (Context context)
 Requests the object to try and acquire all the objects that it depends on and initialize itself.
See also
IInitializableExtensions.Init<TInitializable, TArgument>

can be used to implement this method in a single line.

 
- Protected Member Functions inherited from Sisus.Init.MonoBehaviourBase
virtual void OnAwake ()
 OnAwake is called when the script instance is being loaded during the Awake event after the InitInternal function has finished.
 
bool Init (Context context)
 Requests the object to try and acquire all the objects that it depends on and initialize itself.
 
void ThrowIfNull< TArgument > (TArgument argument)
 Checks if the argument is null and throws an System.ArgumentNullException if it is.
 
void AssertNotNull< TArgument > (TArgument argument)
 Checks if the argument is null and logs an assertion message to the console if it is.
 
virtual void ValidateArgument< TArgument > (TArgument argument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument, TNinthArgument ninthArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument, TTenthArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument, TNinthArgument ninthArgument, TTenthArgument tenthArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument, TTenthArgument, TEleventhArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument, TNinthArgument ninthArgument, TTenthArgument tenthArgument, TEleventhArgument eleventhArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
virtual void ValidateArguments< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument, TTenthArgument, TEleventhArgument, TTwelfthArgument > (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument, TNinthArgument ninthArgument, TTenthArgument tenthArgument, TEleventhArgument eleventhArgument, TTwelfthArgument twelfthArgument)
 Method that can be overridden and used to validate the initialization arguments that were received by this object.
 
void HandleValidate< TArgument > (Context context, TArgument argument)
 Handles validating the initialization argument that was received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument, TNinthArgument ninthArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument, TTenthArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument, TNinthArgument ninthArgument, TTenthArgument tenthArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument, TTenthArgument, TEleventhArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument, TNinthArgument ninthArgument, TTenthArgument tenthArgument, TEleventhArgument eleventhArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 
void HandleValidate< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument, TSeventhArgument, TEighthArgument, TNinthArgument, TTenthArgument, TEleventhArgument, TTwelfthArgument > (Context context, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument, TSeventhArgument seventhArgument, TEighthArgument eighthArgument, TNinthArgument ninthArgument, TTenthArgument tenthArgument, TEleventhArgument eleventhArgument, TTwelfthArgument twelfthArgument)
 Handles validating the initialization arguments that were received by this component, if Play Mode is active, and Null Argument Guard has been enabled for the component.
 

Properties

object this[[DisallowNull] string memberName [set]
 Assigns an argument received during initialization to a field or property by the memberName given name.
 
- Properties inherited from Sisus.Init.MonoBehaviourBase
static NullExtensions.NullComparer Null [get]
 A value against which any object can be compared to determine whether or not it is null or an UnityEngine.Object which has been destroyed.
 
static NullExtensions.NullOrInactiveComparer NullOrInactive [get]
 A value against which any object can be compared to determine whether or not it is null or an UnityEngine.Object which is inactive or has been destroyed.