Local Services

  08. Reference No Comments

Services that can automatically be delivered to clients by Init(args) can be split into two groups based on their availability: local and global services.

A local service is a service that is only available to select clients, depending on their location in the scene hierarchies.

Unlike global services, local services only exist for a limited time – until they or the GameObject to which they’re attached is destroyed.

Registering Local Services

Local services can be registered using any the following methods:

  1. By attaching the Service Tag to a component and setting Availability to something other than Everywhere.
  2. By dragging an Object into a Services component and setting To Clients to something other than Everywhere.
  3. Manually using Service.AddFor with a clients argument other than Everywhere.

Registering Plain C# Objects

Plain C# objects can be registered as local services using any the following methods:

  1. By attaching the Service Tag to a Wrapper that wraps the plain C# object.
  2. By dragging a value provider that returns the plain C# object into a Services component.

Leave a Reply

Your email address will not be published. Required fields are marked *