Unity-Technologies / arfoundation-demos

AR Foundation demo projects
Other
500 stars 128 forks source link

KeyNotFoundException after adding ARPlane prefab to ARPlaneManager #45

Closed jBachalo closed 3 years ago

jBachalo commented 3 years ago

After adding a ARPlane Prefab to ARPlaneManager I get constant KeyNotFoundException errors

This is the Xcode console output KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x00000] in <00000000000000000000000000000000>:0 at MeshClassificationManager.SetCurrentClassification (UnityEngine.XR.ARSubsystems.TrackableId meshID, System.Int32 triangleIndex) [0x00000] in <00000000000000000000000000000000>:0 at MeshClassificationManager.Update () [0x00000] in <00000000000000000000000000000000>:0

DanMillerDev commented 3 years ago

Hi, thanks for finding this bug! This was caused by having a collider on the default AR Plane prefab used in the other scenes. The collider wasn't necessary but did conflict with the physic raycast against the mesh generated from the ARMeshManager.

Because the planes had colliders it was trying to identify them based on their names and trackable ID's in the mesh dictionary, I've removed the colliders in this commit https://github.com/Unity-Technologies/arfoundation-demos/commit/ec0ceed3617f4309a77bb8b053c66d657c5982f3 and they should be fixed in the main branch now.