Unity UWP:HoloLens 的全息远程处理

Unity UWP: Holographic Remoting for HoloLens

我关注了这个 Unity 博客 Post tutorial。在 Unity IDE 中一切正常,但是当我构建它时,UWP 应用程序抛出异常:

InvalidOperationException: Enable VR Streaming to allow connection to remote holographic device

我的Unity版本:2018.03

有人知道解决方法吗?

如果使用 MRTK,请使用菜单项应用项目设置。

Mixed Reality Toolkit > Configure > Apply Mixed Reality Project Settings

否则,请按照 Microsoft instructions 使用 hololens/Unity 进行操作,您链接的教程假设已经完成。关键选项可能是:

Player Settings > Universal Windows Platform tab > XR Settings group > Virtual Reality Supported 

解决方法如下:

关于在 Unity UWP 构建中具有全息远程处理功能,您应该在 Player XR 设置中打开 'WSA Holographic Remoting' 并加载两个 SDK,第一个应设置为 'None',第二个应设置为设置为 'Windows Mixed Reality'。如果您不这样做,您的 UWP 应用将在混合现实门户中打开,而不是在普通应用中打开。

在你的脚本中的任何地方加载你的 WindowsMR SDK 在 Start() 方法中是这样的:

private void Start()
{
    StartCoroutine(LoadingWindowsMrWrapper());
}

private IEnumerator LoadingWindowsMrWrapper()
{
    yield return new WaitForSeconds(1);
    StartCoroutine(LoadDevice("WindowsMR"));
}

private static IEnumerator LoadDevice(string newDevice)
{
        XRSettings.LoadDeviceByName(newDevice);
        yield return null;
        XRSettings.enabled = true;
}

如果您有 UI 连接按钮,则可以调用您的 HolographicRemoting.Connect(ipAddress);。现在您应该已连接。

此外,在应用程序退出之前,请确保您已断开连接。

如果它不适合您,请告诉我。