AmbiguousMatchException: Ambiguous matching in method resolution

On my Windows machine i have issues with the Animation Editor for some reason… I have problems when i move beyond the last Key but i can move around inside existing keys no problem… I have worked with that issue… But now i have a new issue.

I was working with a different problem i was having on my Mac so i was doing a test on my Win machine.

I created an Animation Event and the pop up window comes up and disappears but will come back up if i click on the event… Then i fill out the data and if i hover over the event i get this big list of errors and my event is still empty and the pop up info window does not come up to tell me what event is there…

AmbiguousMatchException: Ambiguous matching in method resolution
System.Reflection.Binder.FindMostDerivedMatch (System.Reflection.MethodBase[ ] match)
System.MonoType.GetMethodImpl (System.String name, BindingFlags bindingAttr, System.Reflection.Binder binder, CallingConventions callConvention, System.Type[ ] types, System.Reflection.ParameterModifier[ ] modifiers)
System.Type.GetMethod (System.String name, BindingFlags bindingAttr)
UnityEditor.AnimationEventPopup.FormatEvent (UnityEngine.GameObject root, UnityEngine.AnimationEvent evt) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/Animation/AnimationEventPopup.cs:91)
UnityEditor.AnimationWindow.EventLineGUI (Rect rect, UnityEditor.AnimationSelection selection) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/Animation/AnimationWindow.cs:2282)
UnityEditor.AnimationWindow.OnGUI () (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/Animation/AnimationWindow.cs:2995)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture)

hi qhomes,

dd you manage to get an answer to your problem? am getting the same issues… if you fixed it, plz let me know how to.

regards
carloz

No i did not get it fixed… i think my problem came up when i opened up my Mac project on my PC… but not sure. I gave up trying to fix it and reopened my project on my Mac and a different project on my PC.

Sorry i am not any help.

Q

I had this issue as well, I found out that the method I was calling was overloaded. Renaming the overload to something different fixed it for me.

1 Like

This problem been solved by " GetMethod(string,BindingFlags) "
you can try it like this:
BindingFlags bf = BindingFlags.OptionalaramBinding;
GetType().GetMethod(funName,bf);

You should read these large methods (aka stack-traces) bottom to top,

Ambiguous matching in method resolution simply means you tried to point to a function that had various signatures.
This made Reflection not sure which of the function variant you wanted.
This error means there is an issue with the latest (uppermost) function invocation.

Use another method such as

meth_PickObjectMeth = type_HandleUtility.GetMethod("myFunction",
                                                 BindingFlags.Static | BindingFlags.Public, //if static AND public
                                                 null,
                                                 new [] {typeof(Vector2), typeof(bool)},//specify arguments to tell reflection which variant to look for
                                                 null)
1 Like

This is a simple problem.

Just call the GetMethod by Types argument, you should specify the method arguments type by giving the GetMethod Types argument.

For example:

Type type = typeof(List<string>);
type.GetMethod ("Add", new Type[] { typeof(string) });

Thanks.