Skip to main content
New Participant
January 15, 2022

Unity spatial anchor query error

I'm trying to query the spatial anchor in this way:

 

 

OVRPlugin.SpatialEntityUuid[] uuidArr = new OVRPlugin.SpatialEntityUuid[numeroAncoreTovate];

for (int i = 0; i < numeroAncoreTovate; i++)
{
    byte[] byteArray = AnchorHelpers.StringToUuid(ancoreSalvateStanza.anchorData[i].spaceUuid);
    uuidArr[i] = new OVRPlugin.SpatialEntityUuid
            {
                Value_0 = BitConverter.ToUInt64(byteArray, 0),
                Value_1 = BitConverter.ToUInt64(byteArray, 8)
            };
}
   
var uuidInfo = new OVRPlugin.SpatialEntityFilterInfoIds
        {
            NumIds = numeroAncoreTovate,
            Ids = uuidArr
        };
   
var queryInfo = new OVRPlugin.SpatialEntityQueryInfo()
        {
            QueryType = OVRPlugin.SpatialEntityQueryType.Action,
            MaxQuerySpaces = 50,
            Timeout = 0,
            Location = OVRPlugin.SpatialEntityStorageLocation.Local,
            ActionType = OVRPlugin.SpatialEntityQueryActionType.Load,
            FilterType = OVRPlugin.SpatialEntityQueryFilterType.Ids,
            IdInfo = uuidInfo
        };
   

ulong requestId = 73;

if (!OVRPlugin.SpatialEntityQuerySpatialEntity(queryInfo, ref requestId))
 {
     Debug.LogError("Unable to retrieve the spatial anchors saved on the device");
 }

 

 

 but I get this error:

 

 

ArgumentException: Type could not be marshaled because the length of an embedded array instance does not match the declared length in the layout.

 

 

What can it be? I'm sure that array uuidArr is fully populated...

    This topic has been closed for replies.