20140222 unity windows lab 移轉實作營

23
Unity X Windows 跨跨跨跨跨跨 台台台台 台台台台台台台台台台 台台台台 台台台 (Raymond)

Upload: meng-ru-tsai

Post on 15-Jan-2015

624 views

Category:

Technology


1 download

DESCRIPTION

20140222 Unity Windows lab 移轉實作營

TRANSCRIPT

Page 1: 20140222 Unity Windows lab 移轉實作營

Unity X Windows跨平台實作營

台灣微軟 開發工具暨平台推廣處資深協理 蔡孟儒 (Raymond)

Page 2: 20140222 Unity Windows lab 移轉實作營

2013/6

Page 4: 20140222 Unity Windows lab 移轉實作營

1. 免費 Windows add-ons

3. MSDN + Unity 優惠 !

4. Unity Labs!實地轉置 + 技術支援

2. 學生 & 新創公司免

費 !

5. App Visibility!

提名精選機會

Page 5: 20140222 Unity Windows lab 移轉實作營

需求• 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 。

Page 6: 20140222 Unity Windows lab 移轉實作營

移植• 設計階段 — 在 Unity Editor  中設計遊戲• 編譯階段 — 從 Unity Editor  生成 Windows App• 執行階段 — 執行 Windows App

Page 7: 20140222 Unity Windows lab 移轉實作營

編譯階段 — 從 Unity Editor  生成 Windows App

建議先選擇 XAML/C# Solution

Page 8: 20140222 Unity Windows lab 移轉實作營

選擇 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等 );缺點則是需要同時控管兩種版本。

Page 9: 20140222 Unity Windows lab 移轉實作營

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 即可。

Page 10: 20140222 Unity Windows lab 移轉實作營

Build 不成功 ?1. missing classes/methods

原因 :• .NET 有很多種… (ASP.NET,

Silverlight, Windows Phone, etc.)

.NET Framework

Windows Store .NET Core

Mono C# runtime

error CS0103: The name 'File' does not exist in the current context”

Page 11: 20140222 Unity Windows lab 移轉實作營

解法 : http://

blogs.msdn.com/b/mengtsai/archive/2014/01/16/unity-game-to-windows-store-compile-error-missing-namespaces-classes.aspx?CommentPosted=true#commentmessage

• 將已實作並編譯出的 MyPlugin.dll 加入 Unity 參考 (reference)• 加入以下 using directives 即可 !

#if UNITY_METRO_8_1 && !UNITY_EDITORusing LegacySystem.IO;#elseusing System.IO;#endif

優點 :1. 完全無需更動遊戲既有的程式碼。2. 承 1. 不會影響到移植至其他平台 (iOS/Android, etc.) 的相容性。

Page 12: 20140222 Unity Windows lab 移轉實作營

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  與相關錯誤的說明。

Page 13: 20140222 Unity Windows lab 移轉實作營

移植流程一旦您已經解決任何編譯階段時的錯誤,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  專案檔案。

Page 14: 20140222 Unity Windows lab 移轉實作營

移植成功了,我想上架• 加入 IAP (In app purchase)?

• Windows Store App: http://code.msdn.microsoft.com/windowsapps/Licensing-API-Sample-19712f1a

• 加入動態磚 ?• Windows Store App: http://

code.msdn.microsoft.com/windowsapps/App-tiles-and-badges-sample-5fc49148

• Windows Store 註冊及上架 : http://www.slideshare.net/mengruts/windows-store-app

• Windows Phone 註冊及上架 : http://www.slideshare.net/mengruts/windows-phone-app-26866495

Page 15: 20140222 Unity Windows lab 移轉實作營

Untiy -> Windows Apps 資源

• Unity 官網 : http://unity3d.com/pages/windows/

• 移植文件 : http://unity3d.com/pages/windows/porting

• 論壇 : http://forum.unity3d.com/forums/50-Windows-Development

• 中文部落格 : http://blogs.msdn.com/b/mengtsai/archive/2014/02/05/windows-store-unity.aspx

Page 16: 20140222 Unity Windows lab 移轉實作營

比賽 /活動資訊只要上架 Windows Store/Windows Phone 市集…

Page 17: 20140222 Unity Windows lab 移轉實作營

App 怪獸爭霸戰• 上架 Windows

Store 或 Windows Phone 市集,即有機會獲得 1萬~10萬獎項

http://monster.azurewebsites.net/

Page 18: 20140222 Unity Windows lab 移轉實作營

Unity 舉辦 :鼓勵更多 Unity App 上架 Windows 市集• 1~2 台 Windows

device (手機 or 平版 )• 10萬 Adduplex

impressions•共同行銷 App• 其他…

http://unity3d.com/pages/windows/offer

2014/2/19

Page 19: 20140222 Unity Windows lab 移轉實作營

BizSpark

創業夢想火花計畫

公司成立小於 5 年年收入小於一百萬美金以開發軟體產品或服務為公司的主要營業項目

Page 20: 20140222 Unity Windows lab 移轉實作營

微軟潛能創意盃 (Imagine Cup)• 微軟潛能創意盃 (Imagine Cup) 從 2003 年開始,每年皆吸引超過 100 個國家,總計超過 35萬學生精英組隊參加。

重要軌跡 年份 紀錄簡介

2003年 首屆潛能創意盃亞太地區亞軍,並獲邀參加世界總決賽。

2006年 數位創作組台灣代表隊獲世界前 6強頭銜。

2007年 台灣代表隊「Circle」打敗全世界兩百多隊參賽者,獲得數位創作組全球亞軍。

2008年 台灣取得軟體設計組、數位創作組、嵌入式系統開發組全球總決賽資格,創下新紀錄。

2009年 台灣參賽人數成長近 3倍。晉級全球競賽第二輪隊伍將近 100組,成長 將近 4 倍。

2009年 打敗眾多強隊取得台灣代表權的兩支隊伍。最後於全球競賽中寫下嵌入式系統組世界前 12 強,以及軟體開發組世界前6強的佳績。

2010年 與教育部合作推出國際競賽台灣代表隊培育計畫,由產官學精英組成教練團,提供學生訓練與建議。

2010年 台灣學生從 113個國家、32萬5千名全球學生精英脫穎而出,首次勇奪包含嵌入式系統組、數位創作組、展望未來 2020組等三項世界冠軍。

2011年 台灣學生從 165個國家、35萬2千名全球學生精英脫穎而出,蟬連嵌入式系統組世界第一、數位創作組世界第三。

Page 21: 20140222 Unity Windows lab 移轉實作營

2013/07 曾志朗院士率團遠赴俄羅斯聖彼得堡台灣「全方位聽力解決方案 (Omni-Hearing Solution)」團隊榮獲軟體設計組「世界公民」 (World Citizenship) 及「全球婦女賦權獎」 (Women‘s Empowerment Award-UN Women) 兩競賽項目亞軍 !

Page 22: 20140222 Unity Windows lab 移轉實作營

DreamSpark

學生夢想火花計畫

免費為學生提供 Microsoft 開發工具及軟體 : 追求自己的夢想,開創新世代的重大技術突破,或藉此踏出職場生涯的第一步。

Page 23: 20140222 Unity Windows lab 移轉實作營

• Unity 設計工具及 Visual Studio 2012/2013 的無縫整合• Windows Store App & Windows Phone App 的免費 add-

ons • 台灣微軟在地技術支援 (MUGA & Unity Labs)•教師及學生免費軟體及上傳• App 行銷支援•國外大型比賽 & Imagine Cup 潛能創意盃