Merge pull request #27 from AnnulusGames/fix-onvaluechanged

Fix: OnValueChanged method with parameters doesn't work
This commit is contained in:
Annulus Games 2024-02-17 15:19:11 +09:00 committed by GitHub
commit 6800d3a455
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -316,13 +316,13 @@ namespace Alchemy.Editor.Drawers
var methods = ReflectionHelper.GetAllMethodsIncludingBaseNonPublic(Target.GetType())
.Where(x => x.Name == methodName);
foreach (var methodInfo in methods)
{
if (methodInfo.Name != methodName) continue;
var parameters = methodInfo.GetParameters();
if (parameters.Length == 1 && parameters[0].GetType() == property.GetPropertyType())
if (parameters.Length == 1 && parameters[0].ParameterType.IsAssignableFrom(property.GetPropertyType()))
{
methodInfo.Invoke(Target, new object[] { property.GetValue<object>() });
}