为什么我会收到异常 UnityEditor.BuildPlayerWindow+BuildMethodException: 6 错误以及如何修复它?

Why I'm getting exception UnityEditor.BuildPlayerWindow+BuildMethodException: 6 errors and how to fix it?

我有unity3d编辑器版本:2018.4.5f1 Personal

当我这样做时:文件 > 构建设置...然后构建或文件 > 构建并且 运行 我在 1-2 秒后得到异常:

第一个:

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

然后:

UnityEditor.BuildPlayerWindow+BuildMethodException: 6 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:194 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:97 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

建筑截图window:

已尝试 google,我在资产中没有任何 plugin/s 文件夹,正如有人建议删除的那样。 其他人建议:"use legacy SDK tools"(播放器设置 >> 发布设置”但是我在编辑器中的任何地方都找不到发布设置。

也许我应该下载并更新到最新的统一编辑器版本?

确保你没有一个空白的脚本来连接彼此的脚本,并确保你的脚本没有错误,比如缺少参考等,尝试更新你的统一 这只是我的意见,因为如果我从脚本中得到一个错误,如果我错了请纠正我

我也为此苦苦挣扎,但以下内容为我解决了这个问题:

  1. 运行 在整个代码库中搜索 "UnityEditor"。
  2. 任何引用 "UnityEditor" 的脚本必须位于名为 "Editor" 的文件夹中,或者必须将 "UnityEditor" 的所有引用包含在预编译标志中以将它们从构建中排除.
  3. 通过预编译标志,我的意思是“#if UNITY_EDITOR”/“#endif”。

来自这个link:https://forum.unity.com/threads/unity-build-errors.663364/

就我而言,我去了 Canvas,(2D 游戏)select编辑了导致问题的动画,Score。单击 Motion 和 select None。 selected 的值为 Blender,我不明白为什么。这解决了所有问题。