Unity5.4.3f1打包到UWP(Universal Windows Platform)平台过程

1.打开Unity工程后切换至UWP平台

  

在菜单栏“File”下选择“Build Settings...”后显示平台选择界面;切换至“Windows Store”,如果显示“No Windows Store Module Loaded.”,则说明未安装Unity中支持UWP平台的模块包,可点击“Open Download Page”打开下载链接,下载完成安装即可。其他属性的配置参考上右图配置即可。最后点击“Switch Platform”完成UWP平台的切换。

2.确保主机已安装好了Windows 10 SDK,需要安装VS2015,安装时需要选择安装好“通用Windows平台开发工具包”。如果主机上只安装了VS2017(已经安装好“通用Windows平台开发工具包”),在打包时Unity会报Bug:Could not start compilationException: 'C:\Program Files (x86)\MSBuild\14.0\Bin\csc.exe' not found, either .NET 4.5 is not installed or your OS is not Windows 8/8.1.,可参考这个链接https://forum.unity.com/threads/unity-5-5-0f3-windows-store-universal-10-build-error.454888/(链接主要就是说,Unity5.5.1之前的版本不能配合VS2017中的相关包打包至UWP平台,可与VS2015配合打包)。这个问题解决后单击“Build”,选择好路径即可成功打包。打包后是一个UWP工程。

3.用VS打开UWP工程后,选择x86平台,本地计算机:,单击”本地计算机“调试建会报Bug:

命令“"D:\DevelopForEday\ResearchAdToUWP\3DPlane\UWPDemo\Unity\Tools\AssemblyConverter.exe" -platform=uap -lock="D:\DevelopForEday\ResearchAdToUWP\3DPlane\UWPDemo\Lesson5.1-3DPlaneWars\project.lock.json" -bits=32 -configuration=Debug -removeDebuggableAttribute=False -path="." -path="..\Players\UAP\x86\Debug" "D:\DevelopForEday\ResearchAdToUWP\3DPlane\UWPDemo\Lesson5.1-3DPlaneWars\Assembly-CSharp-firstpass.dll" "D:\DevelopForEday\ResearchAdToUWP\3DPlane\UWPDemo\Lesson5.1-3DPlaneWars\Assembly-CSharp.dll" "D:\DevelopForEday\ResearchAdToUWP\3DPlane\UWPDemo\Lesson5.1-3DPlaneWars\UnityEngine.dll" "D:\DevelopForEday\ResearchAdToUWP\3DPlane\UWPDemo\Lesson5.1-3DPlaneWars\UnityEngine.UI.dll" "D:\DevelopForEday\ResearchAdToUWP\3DPlane\UWPDemo\Lesson5.1-3DPlaneWars\UnityEngine.Networking.dll"”已退出,代码为 1。 

参照上面的-lock="D:\DevelopForEday\ResearchAdToUWP\3DPlane\UWPDemo\Lesson5.1-3DPlaneWars\project.lock.json"找到路径中的这个Json文件

修改“UAP, Verson=v10.0.10240”为“UAP, Verson=v10.0”即可。原因可参考这个链接:https://www.songshizhao.com/blog/blogPage/436.html。修改好后点击调试即可运行程序了。

posted @ 2018-08-15 14:42  捡了个贝壳  阅读(3671)  评论(0编辑  收藏  举报