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

◆ TryGet< TClient, TArgument >() [1/2]

static bool Sisus.Init.InitArgs.TryGet< TClient, TArgument > ( Context context,
[DisallowNull] TClient client,
out TArgument argument )
static

Retrieves initialization argument that has been provided for the client.

The argument can be provided using the Set<TClient, TArgument> method, or by registering it as a service.

When called in the context of the Reset event in edit mode and the TClient class has the the AutoInit attribute or a RequireComponent attribute for the argument it accepts, then the argument can also be retrieved autonomously by this method using methods such as GetComponent or FindAnyObjectByType.

The client must implement the IArgs<TArgument> interface in order for it to be used with this function.

Template Parameters
TClientThe type of the client object.
TArgumentThe type of the argument.
Parameters
contextInitialization phase during which the method is being called.
clientThe object whose dependencies to retrieve.
argumentThe argument received, or default value if no stored argument was found.
Returns
true if an argument had been provided for the object; otherwise, false.
Exceptions
ArgumentNullExceptionThrown if client argument is null.
Type Constraints
TClient :IArgs<TArgument>