Azure空间锚:初始化cloudSpatialAnchorSession异常



你好,我有一个问题,通过代码初始化cloudSession。

这个想法是太附加这个脚本到现场的AzureManager游戏对象....对于一个会话和多个对象要锚定,

这对你来说有意义吗?

然而,如果这个想法对你来说是好的,我有一个错误的开始会话初始化会话错误

任何想法?由于安德里亚

using Microsoft.Azure;
using Microsoft.Azure.SpatialAnchors;
using Microsoft.Azure.SpatialAnchors.Unity;
using Microsoft.MixedReality.OpenXR;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.XR.WSA;
using UnityEngine.XR.WSA.Input;

public class AnchorsManager : MonoBehaviour
{
/// <summary>
/// Local Anchor
/// </summary>
private GameObject localAnchor;
/// <summary>
/// AZURE settings AccountId
/// </summary>
private string AccountId = "00886172-b4....";

/// <summary>
/// AZURE settings AccountKey
/// </summary>
private string AccountKey = "xmQmM5zD3HNDZB0RAl6PsnSDVdm2l+.....";

/// <summary>Azure subscription 1
/// AZURE settings AccountDomain
/// </summary>
private string AccountDomain = "northeurope.mixedreality.azure.com";
/// <summary>
/// Azure session 
/// </summary>    
private CloudSpatialAnchorSession cloudSession;


void Start()
{
InitializeSession();
}

public void onMouseDown(GameObject localAnchor)
{
this.localAnchor = localAnchor;
this.cloudSession.Start();
}

/// <summary>
/// Inizialize the cloudSpatialAnchorSession.
/// </summary>
void InitializeSession()
{

try {
this.cloudSession = new CloudSpatialAnchorSession();
this.cloudSession.Configuration.AccountId = this.AccountId;
this.cloudSession.Configuration.AccountKey = this.AccountKey;
this.cloudSession.Configuration.AccountDomain = this.AccountDomain;

this.cloudSession.SessionUpdated += (sender, args) =>
{
if (args.Status.RecommendedForCreateProgress != 0)
{
// TODO CREATE ANCOR FUNCTION
}
};    

}
catch (Exception ex) {            
Debug.LogError("Error on initialize the session: " + ex.Message);
}
}        
}

错误是

Error on initialize the session: AzureSpatialAnchors assembly:<unknown assembly> type:<unknown type> member:(null)
谢谢你的帮助安德里亚

对于这个问题,很可能是由于使用OpenXR和XR.WSA的代码所使用的版本中的Unity冲突。

对于ASA SDK,我们建议使用OpenXR + Unity 2020/2021 LTS版本的Unity,这意味着删除这些引用:

using UnityEngine.XR.WSA;
using UnityEngine.XR.WSA.Input;

如果使用HoloLens,建议从以下示例开始:https://learn.microsoft.com/en - us/azure/spatial anchors/how tos/setup - - project?tabs=xr插件统一framework%2cunity - 2020% - 2 cunity -包装-混合现实——功能——tool%2cextraconfigurationshololens

相关内容

  • 没有找到相关文章

最新更新