Unity3D 2017.3无法构建任何项目报错求助
解决Unity 2017.2升级至2017.3后空项目构建失败的问题
你遇到的是Unity跨小版本升级时典型的UI模块引用路径错乱问题——报错明确指出UnityEngine.UI.dll引用了UnityEngine程序集,但要么找不到该程序集,要么它不允许被包含,大概率是升级后Editor路径残留了旧版本/错误版本的UI扩展文件导致的。
下面是几个经过验证的解决方案,建议按优先级尝试:
1. 清理Unity Editor的UI扩展缓存
- 定位报错里提到的UI.dll路径:
D:/Program Files/Unity2018/Editor/Data/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll - 先关闭Unity编辑器,然后删除整个
GUISystem文件夹 - 重新打开Unity,它会自动重新生成适配当前2017.3版本的UI扩展文件
2. 重置项目的程序集引用
- 在项目的
Assets文件夹下创建临时Editor文件夹,新建一个C#脚本,输入以下代码:
using UnityEditor; using UnityEngine; public class ResetAssemblyReferences : EditorWindow { [MenuItem("Tools/Reset Assembly References")] public static void ShowWindow() { EditorUtility.DisplayDialog("提示", "即将重置程序集引用,Unity会自动重启", "确认"); AssetDatabase.Refresh(); EditorApplication.Exit(0); } }
- 点击顶部菜单栏的
Tools > Reset Assembly References,确认后Unity会重启,重启后尝试重新构建
3. 彻底重新安装Unity 2017.3
如果前两种方法都无效,说明可能是安装过程中出现了文件损坏:
- 先通过Unity Hub(或官方卸载工具)彻底卸载2017.3版本,注意勾选删除相关缓存文件
- 重新下载2017.3的官方安装包,选择自定义安装,确保勾选
GUISystem扩展模块 - 安装完成后创建新的空项目,再尝试构建
补充说明
这个问题在Unity 2017系列的小版本升级中比较常见,核心原因是旧版本的扩展文件没有被完全覆盖,导致程序集引用链断裂。另外要注意,你的报错里提到的路径是Unity2018的文件夹,这可能是你之前安装过2018版本,Unity在升级时错误地引用了旧版本的UI文件——所以第一步清理路径时一定要确认是对应2017.3版本的Editor文件夹,不要搞错了!
附原始报错信息:
- ArgumentException: The Assembly UnityEngine is referenced by UnityEngine.UI ('D:/Program Files/Unity2018/Editor/Data/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll'). But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary2 cache, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:156)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:196)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)- Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)- UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
内容的提问来源于stack exchange,提问作者KiritoPlan
相关产品推荐
相关产品推荐

