編譯部署

Export to HTML5 WebGL

檔案結構

.htaccess      # 覆寫伺服器存取規則
index.html
Release/       # 編譯後未壓縮的遊戲檔案
Compressed/    # 編譯後已壓縮的遊戲檔案
TemplateData/  # 下所有檔案可換為自製圖

設定一覽

僅供參考用,根據個人需求調整。

  • Build Settings
    • Optimization Level - Fastest (very slow builds)
  • Player Settings
    • Other Settings
      • Stripping Level - Use micro mscorlib
    • Publishing Settings
      • WebGL Memory Size - 222 MB (use profiler to find out)
      • Enable Exceptions - None
      • Data Caching - Enable

.htaccess

  • 如果是允許.htaccess的伺服器則可將Release/移除,以Compressed/取代。
  • 如果是不允許.htaccess的伺服器(itch.io)則必須連同Release/一起壓縮並上傳。

其他

  • 上傳itch.io後,滑鼠事件可正常運作但鍵盤不能,是因為當沒有focus在iframe上時,鍵盤事件是無法觸發的,只要將開成全螢幕或者加入下方語法至index.html中即可。
window.onload = function(){
    window.focus();
}

window.onclick = function(){
    window.focus();
}
  • 如果跳出一堆Warning是有關Mip Maps的,請直接將所有圖示的Generate Mip Maps的設定全部關掉,因為Mip Maps在WebGL無法執行。

Ref:

64-bit and iOS 8 Requirements for New Apps

蘋果官方宣布從2015/02/01開始,所有上傳至Apple Store的App皆必須支援64-bit而且必須是用iOS 8的SDK建置而成。

Ref: Apple News

iOS 建置指南

如果專案沒有使用其他外掛,非常建議可以將Scripting Backend設定成IL2CPP用以提升整體效能。另外就是將Architecture設定成Universal,如此一來產生的XCode專案便支援64-bit了。

Ref: UNITY 4.6.2 IOS 64-BIT SUPPORTUpgrading to 64 bit iOS

Android Debug Tool

可以擷取log的Debug工具

// better solution
./monitor

// clear log first
./adb logcat -c
// (1) dump log with unity tag
./adb logcat -s unity > ~/desktop/log.txt
// (2) more specific information
./adb logcat -s unity activitymanager packagemanager dalvikvm debug > ~/desktop/log.txt

Testflight

  • 取得裝置的UDID填入Devices of CIP
  • 建立一個for Ad-Hoc的Provision Profile。
  • Build > Archive > Organizer > Export > Ad-Hoc > Select P-Profile > .ipa
  • 上傳.ipa並發送邀請給測試玩家。
  • 玩家使用裝置打開testflight即可開始測試。

Can't find java directory location

在輸出APK時出現如下錯誤訊息

error building player: win32exception: applicationname='c:\program files (x86)\java\jre7\bin\javac.exe'

顯然Unity無法偵測到java資料夾的位置,代表開發者沒有安裝jdk或者沒有正確設定系統環境變數。

Unable to convert classes into dex format

我曾將Facebook, Admob以及Soomla三家的SDK整合至一款遊戲當中,使得此三SDK中所含的jar重複導致此問題發生,目前的方法是將多餘的jar移除,但問題是我該移除哪個jar檔?截自目前為止我嘗試的方法是一個一個拔除直到沒有error為止。(土法煉鋼 Orz)

Ref: multiple-plugin-conflict

Xcode編譯時出現"Command /usr/bin/codesign failed with exit code 1"

Xcode -> Preferences -> Accounts -> Choose your account, and then View Details -> Refresh (button on bottom left)

Provision Profile未同步導致問題發生。

Ref: stackoverflow

在Xcode打包完成送Validate時出現"You are not authorized to use this service"

移除在Xcode Preferences中的Apple ID並重新加入即可解決。

Ref: stackoverflow

results matching ""

    No results matching ""