UnityPlugin icon indicating copy to clipboard operation
UnityPlugin copied to clipboard

KeyNotFoundException: The given key 'Left HardContactHand (Leap.Unity.PhysicalHands.HardContactHand)' was not present in the dictionary.

Open vincentsys opened this issue 1 year ago • 4 comments

Hi, I have encountered following incident which occurs infrequently while using ultraleap hand tracking. It leads to a crash of the app. It sometimes occurs with the Left HardContactHand and sometimes with the Right HardContactHand.

The error message is following:

KeyNotFoundException: The given key 'Left HardContactHand (Leap.Unity.PhysicalHands.HardContactHand)' was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <834b2ded5dad441e8c7a4287897d63c7>:0)
Leap.Unity.PhysicalHands.GrabHelperObject.SetBoneGrabbing (Leap.Unity.PhysicalHands.ContactHand hand, System.Boolean add) (at ./Library/PackageCache/[email protected]/Physical Hands/Runtime/Scripts/Helpers/GrabHelperObject.cs:845)
Leap.Unity.PhysicalHands.GrabHelperObject.UpdateGrabbingValues () (at ./Library/PackageCache/[email protected]/Physical Hands/Runtime/Scripts/Helpers/GrabHelperObject.cs:821)
Leap.Unity.PhysicalHands.GrabHelperObject.UpdateHelper () (at ./Library/PackageCache/[email protected]/Physical Hands/Runtime/Scripts/Helpers/GrabHelperObject.cs:357)
Leap.Unity.PhysicalHands.GrabHelper.UpdateHelpers () (at ./Library/PackageCache/[email protected]/Physical Hands/Runtime/Scripts/Helpers/GrabHelper.cs:223)
Leap.Unity.PhysicalHands.GrabHelper.OnFixedFrame (Leap.Frame frame) (at ./Library/PackageCache/[email protected]/Physical Hands/Runtime/Scripts/Helpers/GrabHelper.cs:89)
Leap.Unity.LeapProvider.DispatchFixedFrameEvent (Leap.Frame frame) (at ./Library/PackageCache/[email protected]/Core/Runtime/Scripts/LeapProvider.cs:79)
Leap.Unity.PhysicalHands.PhysicalHandsManager.ProcessFrame (Leap.Frame inputFrame) (at ./Library/PackageCache/[email protected]/Physical Hands/Runtime/Scripts/PhysicalHandsManager.cs:263)
Leap.Unity.LeapProvider.DispatchFixedFrameEvent (Leap.Frame frame) (at ./Library/PackageCache/[email protected]/Core/Runtime/Scripts/LeapProvider.cs:79)
Leap.Unity.PostProcessProvider.processFixedFrame (Leap.Frame inputFrame) (at ./Library/PackageCache/[email protected]/Core/Runtime/Scripts/PostProcessProvider.cs:177)
Leap.Unity.LeapProvider.DispatchFixedFrameEvent (Leap.Frame frame) (at ./Library/PackageCache/[email protected]/Core/Runtime/Scripts/LeapProvider.cs:79)
Leap.Unity.XRLeapProviderManager.HandleFixedFrame (Leap.Frame _frame) (at ./Library/PackageCache/[email protected]/Core/Runtime/Scripts/XRLeapProviderManager.cs:194)
Leap.Unity.LeapProvider.DispatchFixedFrameEvent (Leap.Frame frame) (at ./Library/PackageCache/[email protected]/Core/Runtime/Scripts/LeapProvider.cs:79)
Ultraleap.Tracking.OpenXR.OpenXRLeapProvider.FixedUpdate () (at ./Library/PackageCache/[email protected]/OpenXR/Runtime/Scripts/OpenXRLeapProvider.cs:131)

Would it be possible to check whether the key exists in the dictionary before accessing it?

vincentsys avatar Jun 10 '24 13:06 vincentsys

Can I just check which version of the Plugin you are using? (or which branch, if not using a released version)

MattGrayUL avatar Jun 10 '24 13:06 MattGrayUL

I'm using version 6.15.0 and the release branch

vincentsys avatar Jun 10 '24 14:06 vincentsys

Thanks - we are currently working on a new major release of the Plugin (7.0.0) which makes some optimizations to the Psychical Hands. We will make sure that if still necessary, we also check for existence of this key before using it :)

MattGrayUL avatar Jun 10 '24 14:06 MattGrayUL

Thank you :)

vincentsys avatar Jun 10 '24 14:06 vincentsys