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

◆ Instance< TScriptableObject, TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument >() [2/2]

static void Sisus.Init.Create.Instance< TScriptableObject, TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument > ( out TScriptableObject instance,
TFirstArgument firstArgument,
TSecondArgument secondArgument,
TThirdArgument thirdArgument,
TFourthArgument fourthArgument )
static

Creates an instance of ScriptableObject of type TScriptableObject and initializes it with the provided arguments.

For classes that derive from ScriptableObject<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument> IInitializable<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument>.Init gets called at the beginning of the Awake event.

For classes that implement IInitializable<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument> IInitializable<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument>.Init is called at the end of initialization, after Awake and OnEnable but before Start.

Classes that implement IArgs<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument> can also manually acquire the dependencies using the InitArgs.TryGet<TClient, TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument> function during any stage of initialization, including the constructor - in which case it is even possible to assign the dependencies into readonly fields.

Template Parameters
TScriptableObjectType of the ScriptableObject to create.
Parameters
instanceWhen this method returns, contains the scriptable object of type TScriptableObject that was created. This parameter is passed uninitialized.
firstArgumentThe first object that the created ScriptableObject depends on.
secondArgumentThe second object that the created ScriptableObject depends on.
thirdArgumentThe third object that the created ScriptableObject depends on.
fourthArgumentThe fourth object that the created ScriptableObject depends on.
Exceptions
InitArgumentsNotReceivedExceptionThrown if TScriptableObject class does not implement IInitializable<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument> and did not manually handle receiving the provided arguments.
Type Constraints
TScriptableObject :ScriptableObject 
TScriptableObject :IArgs 
TScriptableObject :TFirstArgument 
TScriptableObject :TSecondArgument 
TScriptableObject :TThirdArgument 
TScriptableObject :TFourthArgument