【问题标题】:Unable to build and run Unity application on HoloLens 2无法在 HoloLens 2 上构建和运行 Unity 应用程序
【发布时间】:2022-02-10 15:33:24
【问题描述】:

我正在尝试使用 Unity 构建我的第一个 HoloLens 应用。我导入了 MRTK 及其功能。我还通过 USB 连接了 HoloLens。一旦我按下“构建并运行”,它就会提供 3 个错误。我的通用 Windows 平台的构建设置如下:

  • 目标设备:HoloLens,
  • 架构师:ARM(我也试过 ARM64),
  • 构建类型:D3D 项目,
  • 目标 SDK 版本:最新安装,
  • 最低平台版本:(所有版本都给出相同的错误),
  • Visual Studio 版本:最新安装,
  • 构建并运行于:USB 设备,
  • 构建配置:发布。

无论构建设置如何,只要我按下“构建并运行”,就会出现以下错误:

BuildFailedException: Deployment failed.
Output:[22:13:39.766] Windows Phone Player Runner started.
[22:13:39.772] Connecting to device.
[22:13:39.788] An error occurred while running: Could not load file or assembly 'Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
   at Microsoft.SmartDevice.Connectivity.DatastoreManager..ctor(DatastoreConfiguration configuration)
   at Microsoft.SmartDevice.Connectivity.DatastoreManager.Get(Int32 localeId)
   at Microsoft.SmartDevice.Connectivity.Wrapper.ConnectivityWrapper12.GetCurrentPlatform(Int32 localeId)
   at WindowsPhonePlayerRunner.Program.GetDevice()
   at WindowsPhonePlayerRunner.Program.Run(String appxPath, RunnerFlags runnerFlags, IEnumerable`1 copyFilesTo)
   at WindowsPhonePlayerRunner.Program.Main(String[] args)
[22:13:39.788] Exiting Windows Phone Player Runner.

ApplicationLauncherImpl.RunOnPhone (System.String commandLine)
ApplicationLauncherImpl.Run (Utility+VisualStudio vs)
ApplicationLauncher.BuildAndRunProject (UnityEditor.Modules.BuildLaunchPlayerArgs args, UnityEditor.WSABuildAndRunDeployTarget deployTarget, System.String platform, Utility+VisualStudio vs)  
UnityEditor.PostprocessBuildPlayer.Launch (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget buildTarget, System.String path, System.String productName, UnityEditor.BuildOptions options, UnityEditor.Build.Reporting.BuildReport buildReport) (at <55729f52d042492e9efc384182ae2feb>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Build completed with a result of 'Failed' in 177 seconds (176835 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <55729f52d042492e9efc384182ae2feb>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <55729f52d042492e9efc384182ae2feb>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

【问题讨论】:

    标签: c# .net unity3d hololens windows-mixed-reality


    【解决方案1】:

    从构建日志看,“Windows Phone Player Runner”相关输出应该是由两个可能的原因引起的:

    1. Unity 版本不正确。
    2. 构建和运行:USB 设备设置

    对于 Unity 版本,我们建议使用 Unity 2020 LTS 版本进行 HoloLens 2 开发:https://unity3d.com/unity/qa/lts-releases?version=2020.3

    对于 Build and Run on 设置,问题是由 Build and Run on: USB Device 设置引起的,这是已知的issue,Unity 无法修复。最佳做法是,请切换到 Local Machine 并生成 Visual Studio 项目。在 Visual Studio 的帮助下,您可以通过无线网络或 USB 电缆将其部署到您的 HoloLens 2。见:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-03
      • 1970-01-01
      • 1970-01-01
      • 2021-05-08
      • 2018-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多