[Unity] 開發 Windows Store App 相關資源整理

[你需要什麼?]

Windows 8 或以上版本:

- Free 90 days eval, or

- 若符合學生資格或成立五年以下新創公司,可分別透過 DreamSparkBizSpark 取得免費高階版本

- MSDN 訂戶可免費下載

Unity 4.2 或以上版本:

- Free 30 days trial (Pro included)

Visual Studio 2012 或以上版本:

- Free Express version, or

- 若符合學生資格或成立五年以下新創公司,可分別透過 DreamSparkBizSpark 取得免費高階版本

- MSDN 訂戶可免費下載

Windows 市集開發人員帳戶 (上架 Windows Store 時需要)

- 開立 Windows 市集開發人員帳戶 (個人帳戶: US$19,公司帳戶: US$99), or

- 若符合學生資格或成立五年以下新創公司,可分別透過 DreamSparkBizSpark 取得一年免費帳戶

- MSDN 訂戶亦有一年免費帳戶

[有正式文件或線上資源可參考嗎?]

- Unity3D/Microsoft 的官方文件請見 Porting tips for Windows Store (813 KB)

- 線上課程 (英文) Porting Unity games to Windows 8.1 & Windows Phone 中的 Module 2~3 特別討論到注意事項及 Duel Runtime environment ,建議一聽。

[開發 Windows Store 或 Windows Phone App 的流程?]

可以簡單分為三步驟:

image 

其中與 iOS 最大的不同是第二點,也就是需要透過 Visual Studio 2012 或以上的版本來進行編繹。

Unity 專案在 “Build And Run” 之後會產生一個完整的 Visual Studio solution,其中的 .sln 檔可以用 Visual Studio 開啟。

imageimage

開發者可以直接編譯成可上傳 Store 的 packages,或是透過 Visual Studio 進行進一步的修改。

Visual Studio 提供完整的模擬器進行測試,不一定要將 App 裝在實體機器上測試。

image

[我遇到 “error CS0103: The name ‘xxxx’ does not exist in the current context”]

其中的 ‘xxxx’ 可能是 File, FileStream, HashTable, Dictionary 等等。解法及原因說明請參考 [Unity Game to Windows Store] Compile error- missing namespaces/classes (中文)

[我遇到 DEP0700 編譯錯誤怎麼辦?]

image

錯誤訊息為:

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 預設將它的 package 包成可在 ARM, x86 及 x64 不同平台執行的版本,而您的 Visual Studio 顯然並不是在 ARM 機器上跑的,所以會產生這個錯誤。

解決方法是,至 Visual Studio 的 Build –> Configuration Manager 中選擇 x86 即可。

image

[我可以在 Visual Studio 上 debug 嗎?]

目前支援對 C# scripts 作偵錯。詳細步驟請見: https://docs.unity3d.com/Documentation/Manual/windowsstore-debugging.html

[那我是用 JavaScript 或 Boo 怎麼辦?]

這是許多既有 Unity 專案會遇到的問題,各位可參考這篇文章Creating a Unity Game for Windows 8中的留言,也就是可以善加使用 ILSpy (https://ilspy.net/) 這個工具。

“The major challenge for existing apps is porting the code from JavaScript to C#. Most of the examples and existing code base (plugin’s etc.) are JavaScript. However there is a very good and free tool called ILSpy that will examine the compiled assembly and decompile it into C#. Private variables will lose their names, some of the code will be hard to read, however it does work and in about 1-3 hours of work you should be able to port your existing Unity Android/iOS game to Windows Phone or Store. This is by far easier than writing a new game in Visual Studio.

Of course the reverse is also true, write your game in Unity for WP8 or W8 and easily (in minutes) port it over to Android iOS”

[有支援我常用的 Plug-ins 嗎?]

以很受歡迎的 Prime31 為例,目前已有 Windows 8 及 Windows Phone 8 的版本,可以持續使用。

image

[可以教我怎麼註冊 Windows Store 及 Windows Phone 市集嗎? ]

以下兩份文件包含註冊以及上架你的 App 的詳細步驟,以及可能遇到的問題說明:

Windows store app 註冊及上架 from Meng-Ru Tsai

Windows phone app 上架說明書 from Meng-Ru Tsai

[其他]

Unity 官方網站亦整理了許多 Windows Store 及 Windows Phone 8 的 FAQ 等相關文件如以下:

延伸閱讀: 我的第一個 Unity3D Windows Store App

(Last update: 2014/1/17)