Global Services

  8. Reference No Comments

Services that can be registered for clients in Init(args) can be split into two categories: global and local services.

A global service, is a service that exists for the entire lifetime of the application, and is always available to all clients, regardless of the clients location in the scene hierarchies.

A global service can be registered in the following ways:

  1. By adding the [Service] attribute to a class.
  2. By attaching the Service Tag to a component and setting Availability to Everywhere.
  3. By dragging a component or a scriptable object into a Services component and setting For Clients to Everywhere.
  4. By manually calling Service.Set.

Plain old C# objects (non-components) can be registered as global services in the following ways:

  1. By adding the [Service] attribute to its class.
  2. By attaching the Service Tag to a Wrapper that wraps the object and setting Availability to Everywhere.
  3. By dragging a Value Provider that returns the object into a Services component and setting For Clients to Everywhere.
  4. By manually calling Service.Set.

Leave a Reply

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