我在月初接入了uwa的性能測試SDK,須要提交一個development build的遊戲安裝包給uwa進行真人真機測試,本文說下如何判斷安裝包是否爲development build。html
直觀上判斷
若是是development build模式打包出來的安裝包,在遊戲的畫面的右下角會有development build的水印,且在切換場景也不會消失android
經過libunity.so判斷
使用壓縮軟件,打開apk,查看libunity.so(在lib/armxx目錄下),若是是development build話libunity.so 會比較大,以Unity2018.4.15f1爲例 development build的有46MB。而release模式只有20MBc#
經過代碼判斷
Unity引擎提供這樣一個接口來訪問是否 development build,原文以下:性能
In the Build Settings dialog there is a check box called "Development Build".測試
If it is checked isDebugBuild will be true. In the editor isDebugBuild
always returns true. It is recommended to remove all calls to Debug.Log when deploying a game, this way you can easily deploy beta builds with debug prints and final builds without.ui
using UnityEngine; public class Example : MonoBehaviour { void Start() { // Log some debug information only if this is a debug build if (Debug.isDebugBuild) { Debug.Log("This is a debug build!"); } } }
Unity 打包設置
不論是經過Unity直接生成apk,仍是導出android studio項目以後再生成apk,都須要加上BuildOptions.Development
,就能保證導出的版本爲developmentthis
BuildPipeline.BuildPlayer(GetScenePaths(), outPath, tag, BuildOptions.Development );