Chinar blog :www.chinar.xin
Chinar 的初衷是将一种简单的生活方式带给世人 使有限时间 具备无限可能 |
助力快速解决 Unity 打包中常见错误 给新手节省宝贵的时间,避免采坑! |
错误发生场景
由于未设置修改 包名 / 公司名 / 项目名
导致报错,最为简单
具体报错信息: |
---|
UnityException: Package Name has not been set up correctly
Please set the Package Name in the Player Settings. The value must follow the convention 'com.YourCompanyName.YourProductName' and can contain alphanumeric characters and underscore.
Each segment must not start with a numeric character or underscore.
Error building Player: 2 errors
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
解决方案: |
---|
更改 公司名 / 包名 / 项目名
错误发生场景
一般高版本的 2017.2-2017.3 都不会报此错误
常见于 5.X 版本
具体报错信息: |
---|
Error:Invalid command android
UnityEditor.HostView:OnGUI()
CommandInvokationFailure: Unable to list target platforms.
Please make sure the android sdk path is correct. See the Console for more details.
Error building Player: CommandInvokationFailure:
Unable to list target platforms.
Please make sure the android sdk path is correct. See the Console for more details.
解决方案: |
---|
更换安卓工具包,至较低的版本
1. 点击下载 —— 安卓工具包 24 版本2. 解压后替换 安卓 SDK 中的 Tools 文件夹
3. 然后重新打包,即可成功!!!
反之:
如果 Unity 版本高,同样需要换成高版本的 安卓 SDK Tools
错误发生场景
由于 Vuforia 不支持 Android TV ,导致报错
具体报错信息: |
---|
Vuforia does not support Android TV. Please disable the Android TV compatibility in the Player Settings.
UnityEngine.Debug:LogError(Object)
BuildObserver:OnPreprocessBuild(BuildTarget, String)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Error building Player: Vuforia does not support Android TV. Please disable the Android TV compatibility in the Player Settings.
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 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)
解决方案: |
---|
所以需要在 Player Setting 中关闭该选项
即可成功打包工程
错误发生场景
打包项目/工程时报错
Unity Asset 目录中,如果脚本中引用了 UnityEditor
那么该脚本就应该放在 Editor 文件夹下 ( 如果没有,就新建一个名为 Editor 的文件夹)
具体报错信息: |
---|
Assets/CreateGuanJians.cs(4,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing an assembly reference?
Error building Player because scripts had compiler errors
Build completed with a result of 'Failed'
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 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
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
解决方案: |
---|
将引用有 UnityEditor 的脚本放在 Editor 文件夹下
( 如果没有,就新建一个名为 Editor 的文件夹)
即可成功打包工程
错误发生场景
打开/新建 Unity 项目时报错
这是由于权限不够,或者网络端口被占用造成的
具体报错信息: |
---|
Socket: bind failed, error: 以一种访问权限不允许的方式做了一个访问套接字的尝试。
(0)
Unable to join player connection multicast group.
解决方案: |
---|
1. 直接 Clear 清空控制台,不用理它
2. 用管理员权限打开 Unity (可选)
错误发生场景
错误不断更新中…最后汇集所有报错指南
请您惠存,支持 Chinar
Chinar 提供一站式《零》基础教程 使有限时间 具备无限可能! |
Chinar 知你所想,予你所求!( Chinar Blog )
本博客为非营利性个人原创,除部分有明确署名的作品外,所刊登的所有作品的著作权均为本人所拥有,本人保留所有法定权利。违者必究
对于需要复制、转载、链接和传播博客文章或内容的,请及时和本博主进行联系,留言,Email: [email protected]
对于经本博主明确授权和许可使用文章及内容的,使用时请注明文章或内容出处并注明网址