Dependency Injection
Services can use the a depenency injection system rather than using ApplicationServices.Get<T> or SceneServices.Get<T>
For example, a scene service can depend on an application service:
[MonoBehaviourService]public partial class EnemyService : MonoBehaviour{ [InjectService] private SaveService _saveService;}This reduces the amount of code you need to write and makes it easier to read.
Any service, such as Pure C# or MonoBehaviour, using the
InjectServiceattribute much use thepartialmodifier as Source Generation is used to set the value of the field.
A scene service can depend on an application service because the application service outlives the scene. However, an application service can not depend on a scene service because the scene services exist after the application services have been created.