android u3d验证,几种方法验证unity是否为development build

我在月初接入了uwa的性能测试SDK,需要提交一个development build的游戏安装包给uwa进行真人真机测试,本文说下如何判断安装包是否为development build。

直观上判断

如果是development build模式打包出来的安装包,在游戏的画面的右下角会有development build的水印,且在切换场景也不会消失

通过libunity.so判断

使用压缩软件,打开apk,查看libunity.so(在lib/armxx目录下),如果是development build话libunity.so 会比较大,以Unity2018.4.15f1为例 development build的有46MB。而release模式只有20MB

通过代码判断

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.

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,就能保证导出的版本为development

BuildPipeline.BuildPlayer(GetScenePaths(), outPath, tag, BuildOptions.Development );

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值