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

◆ GetForAsync< TService >()

static async System.Threading.Tasks.Task< TService > Sisus.Init.Service.GetForAsync< TService > ( [DisallowNull] Component client,
Context context = Context::MainThread )
static

Gets service of type TService for client asynchrounously.

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 will suspend the execution of the calling async method until a service of type becomes available for the client .

Template Parameters
TServiceThe defining type of the service.
Parameters
clientThe client that needs the service.
contextInitialization phase during which the method is being called.
Returns
Service of type TService .