Init(args)
Scripting Reference
Loading...
Searching...
No Matches
Sisus.Init.ScriptableObject< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument > Class Template Referenceabstract

Description

A base class for scriptable objects that can be created or instantiated with five 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 object depends on any classes that don't have the ServiceAttribute, then an ScriptableObjectInitializer<TScriptableObject, TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument> can be used to specify its initialization arguments.

Instances of classes inheriting from ScriptableObject<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument> 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.
Inheritance diagram for Sisus.Init.ScriptableObject< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument >:
Sisus.Init.IInitializable< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument > Sisus.Init.IInitializable Sisus.Init.IArgs< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument > Sisus.Init.IFiveArguments Sisus.Init.IFirstArgument< TFirstArgument > Sisus.Init.ISecondArgument< TSecondArgument > Sisus.Init.IThirdArgument< TThirdArgument > Sisus.Init.IFourthArgument< TFourthArgument > Sisus.Init.IFifthArgument< TFifthArgument >

Protected Member Functions

void Init (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument)
 Provides the ScriptableObject with the objects that it depends on.
 
virtual void OnReset ()
 Reset state to default values.
 
virtual void OnAwake ()
 OnAwake is called when the script instance is being loaded during the Awake event after the Init method has finished. This happens as the game is launched and is similar to MonoBehavior.Awake.
 
virtual void ValidateArguments (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.
 
void ThrowIfNull< TArgument > (TArgument argument)
 Checks if the argument is null and throws an 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.
 

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 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 Object which is inactive or has been destroyed.
 

Additional Inherited Members

- Public Member Functions inherited from Sisus.Init.IArgs< TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument >
void Validate (TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument)
 Validates the initialization arguments that were provided to this client.