更新到 Unity 2019.3 后无法编译 Unity WebGL

Unable to compile Unity WebGL after updating to Unity 2019.3

我有一个 Unity 2019.2 项目,我刚刚更新到 Unity 2019.3,打开项目时编辑器没有错误,我什至可以以 .exe 形式构建 Windows 设备。所以我开始开发一些功能,一切都很好,它仍然建立在 Windows 之上。所以我尝试将我的平台切换到 WebGl。一切似乎都很好,我什至可以 运行 我的项目。但是一旦我点击构建,我就会收到以下错误:(每个错误都用一行分隔)

Library\PackageCache\com.unity.xr.legacyinputhelpers@2.0.2\Runtime\TrackedPoseDriver\TrackedPoseDriver.cs(185,13): error CS1069: The type name 'PoseData' could not be found in the namespace 'UnityEngine.XR.Tango'. This type has been forwarded to assembly 'UnityEngine.ARModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' Enable the built in package 'AR' in the Package Manager window to fix this error.

Library\PackageCache\com.unity.xr.legacyinputhelpers@2.0.2\Runtime\TrackedPoseDriver\TrackedPoseDriver.cs(186,17): error CS0103: The name 'TangoInputTracking' does not exist in the current context

Library\PackageCache\com.unity.xr.legacyinputhelpers@2.0.2\Runtime\TrackedPoseDriver\TrackedPoseDriver.cs(186,91): error CS0103: The name 'PoseStatus' does not exist in the current context

Error building Player because scripts have compile errors in the editor

Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: Error building Player because scripts have compile errors in the editor
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00275] in <6f28216fea9f453abf2e05b770ed3ee4>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <6f28216fea9f453abf2e05b770ed3ee4>:0 
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

尝试在 WebGL 中构建后,我无法再 运行 编辑器中的项目,但是如果我将平台切换回 Windows,错误消失,我可以 运行 编辑器中的项目甚至编译 Windows。但是切换回 WebGL 并尝试编译再次中断它。

这似乎与 Unity 2019.3 现在基于包的方式有关,但我无法判断这是 UI 问题、输入系统问题还是任何其他无穷无尽的问题.其他人可以破译错误并提供解决方案吗?

编辑:尝试在包管理器中更新 Unity XR 后,我现在收到以下错误,这次出现的错误只是切换平台而不是为它构建:

Library\PackageCache\com.unity.xr.legacyinputhelpers@2.0.6\Runtime\TrackedPoseDriver\TrackedPoseDriver.cs(188,13): error CS1069: The type name 'PoseData' could not be found in the namespace 'UnityEngine.XR.Tango'. This type has been forwarded to assembly 'UnityEngine.ARModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' Enable the built in package 'AR' in the Package Manager window to fix this error.

Library\PackageCache\com.unity.xr.legacyinputhelpers@2.0.6\Runtime\TrackedPoseDriver\TrackedPoseDriver.cs(189,17): error CS0103: The name 'TangoInputTracking' does not exist in the current context

Library\PackageCache\com.unity.xr.legacyinputhelpers@2.0.6\Runtime\TrackedPoseDriver\TrackedPoseDriver.cs(189,91): error CS0103: The name 'PoseStatus' does not exist in the current context

以某种方式更新到 Unity 2019.3 时,Unity 似乎自动安装了一个名为 "XR Legacy Input Helpers" See Reference Image 的包,我尝试通过打开包管理器更新包来更新包,但是这只是造成了更多错误。

我发现删除包是有效的,因为没有人在使用它,而且我不知道为什么 Unity 甚至安装了它。如果我使用这个包,虽然我不知道我会做什么。

感谢@BugFinder & 和@Ankit 帮助我找到问题的解决方案。

我将一个项目从 2019.1 升级到 2019.3 后,我也遇到了关于

的错误

Library\PackageCache\com.unity.xr.legacyinputhelpers@2.0.6\Runtime\TrackedPoseDriver\TrackedPoseDriver.cs

与 Jhon Piper 的回答类似,我发现添加了对 com.unity.xr.legacyinputhelpers 的不需要的依赖项。

我的解决方案是删除此依赖项。 除了使用包管理器,您还可以手动执行此操作。 以下是必要的步骤:

1 - 打开项目文件夹/Packages/manifest.json

2 - 你会看到这样的东西:

{
  "dependencies": {
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.2d.tilemap": "1.0.0",
    "com.unity.ads": "2.0.8",
    ...
  }
}

3 - 在此文件中,删除提及包 com.unity.xr.legacyinputhelpers 的行并保存文件。