From fa64556761a68cc97176fae8fc1038eec666453b Mon Sep 17 00:00:00 2001 From: "Simon (Darkside) Jackson" Date: Wed, 20 Nov 2024 12:26:01 +0000 Subject: [PATCH] Since the addition of Dependency Injection, the priority order is causing issue with Service Ordering. Removing the feature to order services by priority until it can be updated to work better with DI (ordering services by dependency need). Also added some log clean-up --- Runtime/Services/ServiceManager.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Runtime/Services/ServiceManager.cs b/Runtime/Services/ServiceManager.cs index 0330aa5..dbcc986 100644 --- a/Runtime/Services/ServiceManager.cs +++ b/Runtime/Services/ServiceManager.cs @@ -421,8 +421,7 @@ private void InitializeServiceLocator(GameObject instance = null) if (ActiveProfile?.ServiceConfigurations != null) { - var orderedConfig = ActiveProfile.ServiceConfigurations.OrderBy(s => s.Priority).ToArray(); - TryRegisterServiceConfigurations(orderedConfig); + TryRegisterServiceConfigurations(ActiveProfile.ServiceConfigurations); } var activeSceneName = SceneManager.GetActiveScene().name; @@ -779,20 +778,17 @@ private bool TryInjectDependentServices(Type concreteType, ref object[] args) return true; } - Debug.Log($"Constructor: {primaryConstructor}"); - foreach (var parameter in parameters) { if (parameter.ParameterType.IsInterface && typeof(IService).IsAssignableFrom(parameter.ParameterType)) { if (TryGetService(parameter.ParameterType, out var dependency)) { - Debug.Log($"Injecting {dependency.Name} into {parameter.Name}"); args = args.AddItem(dependency); } else { - Debug.LogError($"Failed to find an {parameter.ParameterType.Name} service to inject into {parameter.Name}!"); + Debug.LogError($"Failed to find an {parameter.ParameterType.Name} service to inject into parameter {parameter.Name} for service {concreteType.Name}!"); } } }