Search Unity

Question Oculus spatial anchor querry error

Discussion in 'VR' started by HRDev, Jan 14, 2022.

  1. HRDev

    HRDev

    Joined:
    Jun 4, 2018
    Posts:
    58
    Hello to everyone, i'm trying to querry the spatial anchor in this way:

    Code (CSharp):
    1.  
    2. OVRPlugin.SpatialEntityUuid[] uuidArr = new OVRPlugin.SpatialEntityUuid[numeroAncoreTovate];
    3.            for (int i = 0; i < numeroAncoreTovate; i++)
    4.             {
    5.                 byte[] byteArray = AnchorHelpers.StringToUuid(ancoreSalvateStanza.anchorData[i].spaceUuid);
    6.                 uuidArr[i] = new OVRPlugin.SpatialEntityUuid
    7.                 {
    8.                     Value_0 = BitConverter.ToUInt64(byteArray, 0),
    9.                     Value_1 = BitConverter.ToUInt64(byteArray, 8)
    10.                 };
    11.             }
    12.        
    13.             var uuidInfo = new OVRPlugin.SpatialEntityFilterInfoIds
    14.             {
    15.                 NumIds = numeroAncoreTovate,
    16.                 Ids = uuidArr
    17.             };
    18.        
    19.             var queryInfo = new OVRPlugin.SpatialEntityQueryInfo()
    20.             {
    21.                 QueryType = OVRPlugin.SpatialEntityQueryType.Action,
    22.                 MaxQuerySpaces = 50,
    23.                 Timeout = 0,
    24.                 Location = OVRPlugin.SpatialEntityStorageLocation.Local,
    25.                 ActionType = OVRPlugin.SpatialEntityQueryActionType.Load,
    26.                 FilterType = OVRPlugin.SpatialEntityQueryFilterType.Ids,
    27.                 IdInfo = uuidInfo
    28.             };
    29.        
    30.             //As usual, we don't care about the requestId
    31.             ulong requestId = 73;
    32.             Debug.Log(">-----------------------------------------------------------< caricaAncoreStanza " + requestId);
    33.             //launch of the query that retrieves all the saved spatial anchors
    34.             if (!OVRPlugin.SpatialEntityQuerySpatialEntity(queryInfo, ref requestId))
    35.             {
    36.                 Debug.LogError("Unable to retrieve the spatial anchors saved on the device");
    37.             }
    but i recive 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 be? i'm shure that array uuidArr is fully populated...