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

◆ TryGetFor< TService >() [2/3]

static bool Sisus.Init.Service.TryGetFor< TService > ( [DisallowNull] Component client,
[NotNullWhen(true), MaybeNullWhen(false)] out TService service )
static

Tries to get service of type TService for client .

The returned service can be a local service registered using a ServiceTag or a Services component in an active scene, or if one is not found, a global service registered using a ServiceAttribute or manually.

This method can only be called from the main thread.

Template Parameters
TServiceThe defining type of the service.
Parameters
clientThe client Component that needs the service.
serviceWhen this method returns, contains service of type TService , if found; otherwise, null. This parameter is passed uninitialized.
Returns
true if service was found; otherwise, false.