![]() |
Init(args)
Scripting Reference
|
A base class for MonoBehaviours that can be instantiated or added to a GameObject with three 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> can be used to specify its initialization arguments.
Instances of classes inheriting from MonoBehaviour<TFirstArgument, TSecondArgument, TThirdArgument> receive the arguments via the Init method where they can be assigned to member fields or properties.
Protected Member Functions | |
void | Init (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument) |
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.
can be used to implement this method in a single line. | |
![]() | |
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. | |
![]() | |
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. | |