zoukankan      html  css  js  c++  java
  • UNITY2018开启deepprofiling

    ADB方式调试游戏步骤

    前提:

    1,手机开启 【开发者模式】【USB调试】

    2,数据线连接手机和电脑

    3,安装adb(注意adb版本不对可能导致adb deveices找不到设备,那就换个adb版本)

    4,打开cmd,CD到adb安装目录

    5,执行 adb devices 命令,如果设备列表不空,则说明手机和电脑已成功建立了ADB 通道

    一,build and run方式

    1,unity2018.3,新建工程,build and run 到手机上

    2,adb shell am start -n com.x.y/com.unity3d.player.UnityPlayerActivity -e "unity" "-deepprofiling"

    开启了deepprofiling模式

    二,已有安装包(必须是 Incrediment build包,且非IL2CPP的)

    1,编辑器切换到安卓平台,即 BuildSettings的Platform切换到Android

    2,手动启动游戏 或 adb shell am start -n com.x.y/com.unity3d.player.UnityPlayerActivity -e "unity" "-deepprofiling" 命令来启动游戏并开启deep调试。

    或 adb shell am start -n com.x.y/com.unity3d.player.UnityPlayerActivity命令来启动游戏并开启浅调试。

    这里的com.unity3d.player.UnityPlayerActivity是默认的Activity名称,如果改过了,就要去AndroidManifest.xml中去看了,默认在TempStagingArea目录下,当加了插件后,则在Plugins目录下,内容如下 :

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.y" xmlns:tools="http://schemas.android.com/tools" android:versionName="0.1" android:versionCode="1" android:installLocation="preferExternal">
      <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
      <application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:debuggable="true" android:isGame="true" android:banner="@drawable/app_banner">
        <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="fullSensor" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
          <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
          </intent-filter>
          <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
        <meta-data android:name="unity.build-id" android:value="66e35793-04cc-4399-99a4-5a84c9b3a349" />
        <meta-data android:name="unity.splash-mode" android:value="0" />
        <meta-data android:name="unity.splash-enable" android:value="True" />
      </application>
      <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="29" />
      <uses-feature android:glEsVersion="0x00020000" />
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
      <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
      <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
      <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
      <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
    </manifest>
    View Code

    3,adb forward tcp:34999 localabstract:Unity-com.x.y

    4,打开profiler, Editor下拉菜单中选择AndroidPlayer(ADB@127.0.0.1:34999),点击record

    5,如果profiler没有开始绘制曲线,则关掉重启,重新操作一次步骤4

    出现的问题:

    使用2017.4打包后开启deepprofiling模式游戏进入失败(花屏或黑屏后无反应),bugly没有任何错误上报。

    后来查unity官方论坛发现是.net版本问题,unity2017.4的.net版本默认是3.5,改成.net4.6后成功打包,成功开启deepprofiling,然而非常卡,比编辑器模式下还要卡。

    【手机上开启deepprofiling,注意:】
    1, 'unity'和'-deepprofiling'之间要有空格

    2,.net版本必须是4.0以上

    3,手机包必须是Incrediment build包,且不能是IL2CPP的

    PS: 本文测试环境为UNITY2018.3.5F1, 在UNITY2017.4之前,deepprofiling只在editor模式下有效,在打包出来的任何平台都无法开启deepprofiling。

    不过在安卓上开启deepprofiling真的是太卡了,oppor9s只有2-6帧。

    然而自从unity2018后,editor模式下的deepprofiling却是完全不卡了(不影响帧率了),unity5.6以前我们的项目开deep时20帧不到,现在升级到2018.3.5后开deep与否不影响帧率

  • 相关阅读:
    python求余、除法运算、向下圆整、round圆整
    【转】从入门到实践 json练习详解~~和ython : groupby 结果浅解,&之后的 y_list=[v for _,v in y]
    ### 模块“*.dll”已加载,但对DllRegisterServer的调用失败,错误代码为0x80070005
    python从excel里读取数据
    文本文件和二进制文件的区别
    析构函数 声明为protected
    c语言中ln,lg,log的表示。c语言中ln,lg,log的表示。
    js设计模式--创建型--单例模式
    js设计模式--创建型--工厂模式
    解决ElementUI的table组件在flex布局下宽度不能自适应的问题
  • 原文地址:https://www.cnblogs.com/timeObjserver/p/10318667.html
Copyright © 2011-2022 走看看