diff --git a/VContainer/Assets/VContainer/Runtime/Internal/ReflectionInjector.cs b/VContainer/Assets/VContainer/Runtime/Internal/ReflectionInjector.cs index bab7c8ec..61ea2221 100644 --- a/VContainer/Assets/VContainer/Runtime/Internal/ReflectionInjector.cs +++ b/VContainer/Assets/VContainer/Runtime/Internal/ReflectionInjector.cs @@ -23,8 +23,8 @@ public static ReflectionInjector Build(Type type) [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Inject(object instance, IObjectResolver resolver, IReadOnlyList parameters) { - InjectFields(instance, resolver); - InjectProperties(instance, resolver); + InjectFields(instance, resolver, parameters); + InjectProperties(instance, resolver, parameters); InjectMethods(instance, resolver, parameters); } @@ -56,26 +56,26 @@ public object CreateInstance(IObjectResolver resolver, IReadOnlyList parameters) { if (injectTypeInfo.InjectFields == null) return; foreach (var x in injectTypeInfo.InjectFields) { - var fieldValue = resolver.Resolve(x.FieldType); + var fieldValue = resolver.ResolveOrParameter(x.FieldType, x.Name, parameters); x.SetValue(obj, fieldValue); } } - void InjectProperties(object obj, IObjectResolver resolver) + void InjectProperties(object obj, IObjectResolver resolver, IReadOnlyList parameters) { if (injectTypeInfo.InjectProperties == null) return; foreach (var x in injectTypeInfo.InjectProperties) { - var propValue = resolver.Resolve(x.PropertyType); + var propValue = resolver.ResolveOrParameter(x.PropertyType, x.Name, parameters); x.SetValue(obj, propValue); } }