From bc5fbeb16cdfa1c81c6ea07ecaa443c64ae13757 Mon Sep 17 00:00:00 2001 From: Simon Edis Date: Tue, 10 Jan 2017 13:14:41 +0800 Subject: [PATCH] Update NVRAttachPointMapper.cs Was getting 'ArgumentException: An element with the same key already exists in the dictionary.' errors, so added a check for duplicate keys --- Assets/NewtonVR/NVRAttachPointMapper.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/NewtonVR/NVRAttachPointMapper.cs b/Assets/NewtonVR/NVRAttachPointMapper.cs index 30d5f206..3a32387d 100644 --- a/Assets/NewtonVR/NVRAttachPointMapper.cs +++ b/Assets/NewtonVR/NVRAttachPointMapper.cs @@ -13,12 +13,12 @@ public class AttachPointMapper public static void Register(Collider col, NVRAttachPoint point) { - Colliders.Add(col, point); + if (!Colliders.ContainsKey(col) ) Colliders.Add(col, point); } public static void Deregister(Collider col) { - Colliders.Remove(col); + if (Colliders.ContainsKey(col)) Colliders.Remove(col); } public static NVRAttachPoint GetAttachPoint(Collider col) @@ -30,4 +30,4 @@ public static NVRAttachPoint GetAttachPoint(Collider col) return point; } } -} \ No newline at end of file +}