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。修改好后點擊調試即可運行程序了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM