zoukankan      html  css  js  c++  java
  • 几种方法验证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 );
    
  • 相关阅读:
    redis问题排查
    javassist介绍
    Idea创建父子工程
    sentry的配置
    Redis的基本操作以及info命令
    es~日期类型需要注意的
    jboss~静态文件路由和自定义日志
    java~RMI引起的log4j漏洞
    链路跟踪~对接阿里ARMS
    navicat~导出数据库密码
  • 原文地址:https://www.cnblogs.com/zhaoqingqing/p/13332683.html
Copyright © 2011-2022 走看看