Skip to main content
New Participant
December 28, 2021

SpatialAnchor Demo Scene/Manager does not work, throws error

Going to the new SpatialAnchor demo scene, navigating to "Create Anchor" on the UI, the pressing A to place it, produces the error.

 

ArgumentException: An item with the same key has already been added. Key: 0
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <31c0f51ac5a24a22ba784db24f4ba023>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <31c0f51ac5a24a22ba784db24f4ba023>:0)
SpatialAnchorSession.tryEnableComponent (System.UInt64 anchorHandle, OVRPlugin+SpatialEntityComponentType type) (at Assets/Oculus/SampleFramework/Usage/SpatialAnchor/Scripts/SpatialAnchorSession.cs:122)
SpatialAnchorSession.CreateSpatialAnchor (UnityEngine.Transform T_UnityWorld_Anchor) (at Assets/Oculus/SampleFramework/Usage/SpatialAnchor/Scripts/SpatialAnchorSession.cs:185)
AnchorSpawner.PlaceAnchorAtTransform (UnityEngine.Transform transform) (at Assets/Oculus/SampleFramework/Usage/SpatialAnchor/Scripts/AnchorSpawner.cs:48)
AnchorUIManager.PlaceAnchor () (at Assets/Oculus/SampleFramework/Usage/SpatialAnchor/Scripts/AnchorUIManager.cs:236)
AnchorUIManager.Update () (at Assets/Oculus/SampleFramework/Usage/SpatialAnchor/Scripts/AnchorUIManager.cs:104)

The anchor does not get placed, as such I have no way to test them.

 

 

    This topic has been closed for replies.

    3 replies

    New Participant
    December 28, 2021

    Upon further inspection, the "Canvas" element that is the anchor menu is missing a script. I don't know what's supposed to be here.

     

     

     

    New Participant
    January 10, 2022

    Any more info on this problem? Do other people who access the scene have the same issues?

     

    January 12, 2022

    I went through Skarred Ghost's tutorial instead of trying to run the provided sample code.

    https://skarredghost.com/2022/01/05/how-to-oculus-spatial-anchors-unity-2/