AmbiguousMatchException for CustomPropertyDrawer

Issue #329 resolved
Former user created an issue

I am getting the following exception when using a custom property drawer. I have tried to give it a priority too, however Odin is still trying to create a drawer for this type, where I want it to be ignored.

AmbiguousMatchException: Ambiguous matching in method resolution Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Sirenix.OdinInspector.Editor.UnityPropertyHandlerUtility Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.

Callstack:

Encountered the following exception when trying to instantiate a drawer of type UnityPropertyAttributeDrawer<ClassTypeReferencePropertyDrawer, ClassImplementsAttribute, ClassTypeConstraintAttribute> UnityEngine.Debug:Log(Object) Sirenix.OdinInspector.Editor.<>c__DisplayClass35_0:<GetAllDrawers>b__2(DrawerInfo) System.Linq.<CreateWhereIterator>c__Iterator1D1:MoveNext() Sirenix.Utilities.<Append>d__191:MoveNext() (at D:/Sirenix/Sirenix Solution/Sirenix.Utilities/Extensions/LinqExtensions.cs:343) System.Linq.Enumerable:ToArray(IEnumerable1) Sirenix.OdinInspector.Editor.DrawerLocator:GetAllDrawers(Type, Type, List1, Boolean) Sirenix.OdinInspector.Editor.DrawerLocator:GetAttributeDrawers(Type, Type, Boolean) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Infos/InspectorPropertyInfo.cs:387) Sirenix.OdinInspector.Editor.DrawerLocator:GetDrawersForMemberInfo(MemberInfo, Type, Boolean) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Infos/InspectorPropertyInfo.cs:524) Sirenix.OdinInspector.Editor.DrawerLocator:GetDrawersForProperty(InspectorProperty) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Infos/InspectorPropertyInfo.cs:535) Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty, GUIContent) Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty) Sirenix.OdinInspector.Editor.InspectorUtilities:DrawPropertiesInTree(PropertyTree) Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/DelayedAttributeDrawer.cs:221) Sirenix.OdinInspector.Editor.OdinEditor:DrawTree() (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Children/PropertyValueCollection.cs:541) Sirenix.OdinInspector.Editor.OdinEditor:DrawOdinInspector() (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Children/PropertyValueCollection.cs:533) Sirenix.OdinInspector.Editor.OdinEditor:OnInspectorGUI() (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Children/PropertyValueCollection.cs:516) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

The following is an extract of my custom drawer -

[CustomPropertyDrawer(typeof(ClassTypeReference))]
[CustomPropertyDrawer(typeof(ClassTypeConstraintAttribute), true)]
[DrawerPriority(0, 0, 1.5)]
public sealed class ClassTypeReferencePropertyDrawer : PropertyDrawer
{
   ...
}

Comments (2)

  1. Log in to comment