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

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

static void Sisus.Init.Service.AddFor< TService > ( Clients clients,
[DisallowNull] TService service )
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 a base type that the service derives from, or the exact type of the service.

This must also be a component type. If you want to register a service that is not a component, or want to register a component service using an interface that it implements, you can use the overload that lets you provide a Component type reference separately.

Parameters
clientsSpecifies which client objects can receive the service instance in their Init function during their initialization.
serviceThe service component to add.
Type Constraints
TService :Component