Represents an object that can provide values of requested types on demand. A scriptable object or component that implements the IValueByTypeProvider interface can be assigned to an Initializer field, if IValueByTypeProvider.CanProvideValue returns true when provided the type of the field and a reference to the initializer. During initialization the Initializer will request the Init argument ..
Category : 8. Reference
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 ..
Services that can be registered for clients in Init(args) can be split into two categories: local and global services. A local service, is a service that is only available to select clients, depending on their location in scene hierarchies relative to the service. A local services can be registered in the following ways: By attaching ..
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 services can be ..
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 ..
Init(args) has been designed with inversion of control in mind and aims to make it as easy as possible to work with interfaces instead of specific classes in Unity. One pain point when using interfaces in Unity is that checking them for null can be problematic. This is because in addition to being actually null, ..
Represents an object that can provide a value of type TValue on demand. A scriptable object or component that implements the IValueProvider<TValue> interface can be assigned to an Initializer field of type TValue. During initialization the Initializer will request the Init argument from the value provider, and pass it to the client’s Init method. Example ..
Methods void Init(TFirstArgument firstArgument, … TwelfthArgument twelfthArgument); Classes that implement IInitializable<T…> have all the same functionality that they would get by implementing an IArgs<T…> interface, but with additional support for their Init function to be called manually by other classes. This makes it possible for classes to inject dependencies even in cases where the object ..
Classes that implement one of the generic IArgs<T…> interfaces can be provided with arguments during initialization (up to a maximum of twelve). Methods such as Instantiate<TObject, T…> and AddComponent<TComponent, T…> can only be used to create instances of classes that implement one of the IArgs<T…> interfaces. A contract to receive arguments Any object that implements ..
The Find class is a utility class that helps in locating instances of objects from loaded scenes as well as assets from the project. It has been designed from the ground up to work well with interface types, making it easier to decouple your code from specific concrete classes. All methods in the Find class ..