5. 需求
• Unity4.3+: Unity免費版本或Unity Pro都可,兩者皆內建免費的 Windows Store和 Windows Phone
add-ons 給所有的Unity開發者。
• Visual Studio: 您可以使用任何 Visual Studio SKU,包括免費的 Visual Studio Express版本。若要移
植至 Windows 8.1 將需要 Visual Studio 2013 ;若要到 Windows 8 則可以使用 Visual Studio 2012。
這兩種版本可以在同一台電腦上一併安裝並執行。
• Windows 8.0 或更高的版本: 即便您未購買 Windows 8,您也可以在http://dev.windows.com 取得 90
天的免費評估版。如果您是在Apple的機器上執行 Mac OS X ,可以選擇如Boot Camp, VMWare 或
是Parallels等來執行Windows 8/8.1。
• Microsoft Account: Microsoft Account是免費的,可由以下網站申請 http://signup.live.com,獲取免費
的開發許可(Developer License)。
• Windows Store 帳戶: 這是在您要將遊戲上架至 Windows Store時的需求。您可選擇要註冊為個人或
公司帳戶,一旦完成註冊後則可同時提交至 Windows Phone Marketplace。個人帳戶註冊費用為$19,
公司帳戶為$99。(學生身份或新創公司則可享有第一年免年費優惠,可分別至
http://DreamSpark.com 及http://BizSpark.com 申請)
• Windows 測試機: Visual Studio內建的模擬器可以模擬諸如多點觸控、各種螢幕解析度等情境;但是,
我們仍建議您在具有觸控及運行Windows RT (ARM-based CPU)的實體機器上測試您的App。
8. 選擇 Type 及 SDK (Windows Store App)
選擇Windows Store的類型 (Type)
• 我們建議先選擇XAML/C# solution ,這可讓你在所見即所得的 XAML UI 設計畫面中,快速建
立啟始畫面(splash screen)、設定(Settings)等各項 UI 元件。若選擇Direct3D & C++ 會生成較底
層的執行元件,會有最好的執行效能,但是會犧牲一些 UI 元件設計時的整合功能而拉長設
計時間。
選擇 SDK
• 我們建議您選擇 Windows 8.1 為發佈平台。然而,若要讓您的遊戲可以在8.0或8.1上皆能執
行的話,您可以:
• 直接生成一個 Windows 8.0 遊戲而不使用8.1的新功能。在此情形下您將以8.0的版本提交到Store,上架
後不論是執行 8.0 或 8.1 的使用者將能夠安裝並執行它。或者:
• 針對8.0 和 8.1生成兩個Visual Studio 專案。在這情形下您將提交兩個遊戲套件(packages)至Store,任某
版本作業系統上的使用者將只能看到其各自版本的遊戲。這種方式的優點在於可在8.1的專屬套件上新
增8.1的特別功能(如Big Tile等);缺點則是需要同時控管兩種版本。
9. Build 成功,以Visual Studio 開啟並編譯時…
Error: DEP0700: Registration of the app failed. Windows cannot install package “你的專案名” because the
package requires architecture ARM, but this computer has architecture x64 (0x80073cf3).
原因是 Unity 預設為 ARM-based CPU。解決方法: 至 Visual Studio 的 Build –> Configuration Manager 中選擇 x86
即可。
10. Build 不成功?
1. missing classes/methods
.NET Framework
error CS0103: The name 'File' does not exist in the current context”
原因:
• .NET 有很多種…(ASP.NET,
Silverlight, Windows Phone,
etc.)
Windows Store .NET Core
Mono C# runtime
12. Build 不成功?
2. Plugins
• Play Maker、NGUI、Prime 31、Facebook SDK for
Unity
• 若要知道協力廠商的外掛程式是否相容於
Windows App ,可以使用 Xamarin提供的線上工具
免費掃描:http://scan.xamarin.com。
所有編譯階段可能遇到的問題,請參閱Windows
Store Porting Techniques 這份技術白皮書的Getting
your app to compile in Unity章節中(第4~6頁),有更
多如何解決API 與相關錯誤的說明。
13. 移植流程
一旦您已經解決任何編譯階段時的錯誤,Unity將匯出一個專案檔,你將會使用 Visual
Studio 打開、測試、執行並發布你的遊戲,亦即以下的兩個步驟:
1.從Unity生成專案。(File -> Build Settings,選擇Windows Store App -> Build)
2.在Visual Studio 中編譯為可上架Windows 市集的二進位檔案
每次以 Unity生成專案的時候,可以每次都選擇相同的資料夾,這樣並不會覆寫到任何已在
Visual Studio中所作過的修改。Unity將只更新的以下資料夾及檔案:
1. 在您專案中的/Data資料夾
2. 專案中的reference assemblies
亦即,您可以直接於Visual Studio 改變專案、添加更多功能、更改manifest或設定檔,即便
您之後在Unity中更改了遊戲內容也不會丟失這些在 Visual Studio 中所作的改變。
另外要注意的是,如果您是更動了Unity的專案檔 (比如新增Plugins 或 references),您將
需要手動合併您的 Visual Studio 專案檔案。
14. 移植成功了,我想上架
• 加入 IAP (In app purchase)?
• Windows Store App: http://code.msdn.microsoft.com/windowsapps/Licensing-APISample-19712f1a
• 加入動態磚?
• Windows Store App: http://code.msdn.microsoft.com/windowsapps/App-tiles-and-badgessample-5fc49148
• Windows Store 註冊及上架: http://www.slideshare.net/mengruts/windows-storeapp
• Windows Phone 註冊及上架: http://www.slideshare.net/mengruts/windowsphone-app-26866495
23. • Unity 設計工具及 Visual Studio 2012/2013 的無縫整合
• Windows Store App & Windows Phone App 的免費 add-ons
• 台灣微軟在地技術支援 (MUGA & Unity Labs)
• 教師及學生免費軟體及上傳
• App 行銷支援
• 國外大型比賽 & Imagine Cup 潛能創意盃
Notas do Editor
Of course, not everyone needs/wants to code to Direct X.. You might already have a game that is written using a portable library or portable library… Microsoft is bringing as many as we can to support our platforms… The ones that have native graphics (or audio) are built on top of directX .. Built on Direct X Meet Windows Phone and Windows Store API & design patterns..