When you register a global or a local service, you will always have to specify – either implicitly or explicitly – one or more defining types for it. In the below example, the Logger class is configured to be a global service with the defining types Logger and ILogger, by explicitly specifying the types in ..
Author : Timo Naskali
Services Component The Services component can be used to register multiple asset and scene based services accessible to select clients. Registering Services Using The Services Component You can attach the Services component to any GameObject using the Add Component menu. Assigning Services Add a new item to the Provides Services list. Drag-and-drop the Object you ..
Service Tag In addition to global services – which are guaranteed to be available to all clients for the entire lifetime of the application – it is also possible to register local services using Service Tags. Local services live as part of scene or prefab assets, and are only available to clients for as long ..
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 ..
Services that can automatically be delivered to clients by Init(args) can be split into two groups based on their availability: global and local services. A global service is a service that is available to all clients, regardless of their location in the scene hierarchies. Registering Global Services The main way to register global services is ..
The [ValueProviderMenu] attribute can be used to introduce new menu items that will be shown in the dropdown menus for all Init arguments of targeted types. The attribute can be added to a ScriptableObject-derived class that implements IValueProvider<TValue> or IValueByTypeProvider. You can then use the Value property to access the value stored inside the field. ..
Add this attribute to a component to have the arguments accepted by it be automatically gathered and passed to its Init function in Edit Mode, whenever any objects in the same scene or prefab that contains the component are modified. This attribute supports any components that implement IInitializable<T>, which includes all classes that derive from ..
Opening The Service Debugger Window You can open the Service Debugger Window using the main menu item Window > Analysis > Service Debugger. Using The Service Debugger Window The window lists all currently active services, which have been registered via ServiceAttributes, Service Tags and Services Components. The first name shown in the list is the ..
Issue When launching the game, a service does not get injected to any of its clients as expected, and an warning similar to the following can be seen in the Console window: Invalid Service Definition: Class of the registered instance ‘MyService’ does not implement the defining interface type of the service ‘IMyInterface’. UnityEngine.Debug:LogWarning (object) Sisus.Init.ServiceUtility:SetInstance ..
Issue An client component does not receive the objects that it depends on in its Init method during its initialization. Cause: Not All Dependencies Are Services One possible reason for this is that the component depends on one or more objects that have not been registered as services. Components that derive from MonoBehaviour<T…> can only ..