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

◆ AddFor< TService >() [1/2]

static void Sisus.Init.Service.AddFor< TService > ( Clients clients,
[DisallowNull] TService service,
[DisallowNull] Component registerer )
static

Registers a service with the defining type TService available to a limited set of clients.

If the provided instance is available to clients Clients.Everywhere then the ServiceChanged<TService>.listeners event will be raised.

Template Parameters
TServiceThe defining type of the service; the class or interface type that uniquely defines the service and can be used to retrieve an instance of it.

This must be an interface that the service implement, a base type that the service derives from, or the exact type of the service.

Parameters
clientsSpecifies which client objects can receive the service instance in their Init function during their initialization.
serviceThe service instance to add.
registererComponent that is registering the service. This can also be the service itself, if it is a component.

This same argument should be passed when removing the instance.