You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[UxmlElement]publicpartialclassMyCustomControl:VisualElement,IBindableElement{[UxmlAttribute("binding-bool-path")]privateString_bindingBoolPath{get;set;}privatePropertyBindingData_isDisplayPathBindingData;privateIReadOnlyProperty<Boolean>_boolProperty;publicvoidSetBindingContext(IBindingContextcontext,IObjectProviderobjectProvider){if(String.IsNullOrWhiteSpace(_bindingBoolPath)){return;}_isDisplayPathBindingData??=_bindingBoolPath.ToPropertyBindingData();_boolProperty=objectProvider.RentProperty<Boolean>(context,_isDisplayPathBindingData);_boolProperty.ValueChanged+=OnBoolPropertyValueChanged;UpdateControlValue(_boolProperty.Value);}publicvoidResetBindingContext(IObjectProviderobjectProvider){UpdateControlValue(false);}[MethodImpl(MethodImplOptions.AggressiveInlining)]protectedvirtualvoidUpdateControlValue(BooleannewValue){Debug.Log($"Value changed to: {newValue}");}privatevoidOnBoolPropertyValueChanged(Objectsender,Booleanflag){UpdateControlValue(flag);}}
This configuration produces following exception
Exception
ArgumentException:Anitemwith the same key has already been added. Key:-1662977815
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert(TKeykey,TValuevalue,System.Collections.Generic.InsertionBehaviorbehavior)(at<835c05e113da4a69bb097e93a682f230>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add(TKeykey,TValuevalue)(at<835c05e113da4a69bb097e93a682f230>:0)
UnityMvvmToolkit.Core.Internal.ObjectHandlers.ValueConverterHandler.RegisterValueConverter(UnityMvvmToolkit.Core.Interfaces.IValueConvertervalueConverter)(atD:/Projects/Bin/UnityMvvmToolkit/src/UnityMvvmToolkit.UnityPackage/Assets/Plugins/UnityMvvmToolkit/Runtime/Core/Internal/ObjectHandlers/ValueConverterHandler.cs:74)
UnityMvvmToolkit.Core.Internal.ObjectHandlers.ValueConverterHandler.RegisterValueConverters(UnityMvvmToolkit.Core.Interfaces.IValueConverter[]converters)(atD:/Projects/Bin/UnityMvvmToolkit/src/UnityMvvmToolkit.UnityPackage/Assets/Plugins/UnityMvvmToolkit/Runtime/Core/Internal/ObjectHandlers/ValueConverterHandler.cs:43)
UnityMvvmToolkit.Core.Internal.ObjectHandlers.ValueConverterHandler..ctor(UnityMvvmToolkit.Core.Interfaces.IValueConverter[]valueConverters)(atD:/Projects/Bin/UnityMvvmToolkit/src/UnityMvvmToolkit.UnityPackage/Assets/Plugins/UnityMvvmToolkit/Runtime/Core/Internal/ObjectHandlers/ValueConverterHandler.cs:18)
UnityMvvmToolkit.Core.BindingContextObjectProvider..ctor(UnityMvvmToolkit.Core.Interfaces.IValueConverter[]converters,System.Collections.Generic.IReadOnlyDictionary`2[TKey,TValue] collectionItemTemplates)(atD:/Projects/Bin/UnityMvvmToolkit/src/UnityMvvmToolkit.UnityPackage/Assets/Plugins/UnityMvvmToolkit/Runtime/Core/BindingContextObjectProvider.cs:26)
UnityMvvmToolkit.Common.MonoBehaviourView`1[TBindingContext].GetObjectProvider()(atD:/Projects/Bin/UnityMvvmToolkit/src/UnityMvvmToolkit.UnityPackage/Assets/Plugins/UnityMvvmToolkit/Runtime/Common/MonoBehaviourView.cs:75)
UnityMvvmToolkit.Common.MonoBehaviourView`1[TBindingContext].SetBindingContext()(atD:/Projects/Bin/UnityMvvmToolkit/src/UnityMvvmToolkit.UnityPackage/Assets/Plugins/UnityMvvmToolkit/Runtime/Common/MonoBehaviourView.cs:99)
UnityMvvmToolkit.Common.MonoBehaviourView`1[TBindingContext].Awake()(atD:/Projects/Bin/UnityMvvmToolkit/src/UnityMvvmToolkit.UnityPackage/Assets/Plugins/UnityMvvmToolkit/Runtime/Common/MonoBehaviourView.cs:28)
The text was updated successfully, but these errors were encountered:
Suppose you have following files:
MyView.uxml
Result.cs
ResultToBooleanConverter.cs
InvertedResultToBooleanConverter.cs
MyView.cs
MyViewModel.cs
MyCustomControl.cs
This configuration produces following exception
Exception
The text was updated successfully, but these errors were encountered: