分享好友 最新资讯首页 最新资讯分类 切换频道
Unity 基础 之 连接 Android 手机 使用 Profiler 基于 2019.3.xandroid手机「Unity 基础 之 连接 Android 手机 使用 Profiler 基于 20
2025-01-14 04:58

 

 

目录

Unity 基础 之 连接 Android 手机 使用 Profiler 基于 2019.3.x

一、简单介绍

二、效果预览

三、注意事项

四、实现步骤

附录

防火墙开启端口:54998-55511 的简单步骤


 

Unity中的一些基础知识点。

本节简单介绍如何连接Android手机,Profiler 调试 ,可能有疏漏,如果您有更好的方法,欢迎留言指正。

 

官方文档:https://docs.unity3d.com/Manual/Profiler.html

Profiler 窗口的上半部分显示随时间推移的性能数据。运行游戏时,每帧都会记录数据,并显示最近几百帧的历史记录。单击特定帧将在窗口的下半部分显示其详细信息。根据当前选择的时间轴区域会显示不同的详细信息。

时间轴的垂直刻度是自动管理的,并会尝试填充窗口的垂直空间。请注意,要显示更多详细信息,比如 CPU Usage 区域中的信息,可删除 Memory 和 Rendering 区域。此外,可选择时间轴和统计信息区域之间的分割线并向下拖动,从而增加用于时间轴图表的屏幕区域。

时间轴包含几个区域:CPU Usage、Rendering 和 Memory。单击面板中的关闭按钮可删除这些区域,而使用性能分析器控件栏中的 Add Area 下拉选单可重新添加这些区域。

请注意,标签区域中的彩色方块可以控制是否显示关联的时间轴。要从显示中删除样本,请单击颜色键。该键将变暗,且数据将从图表中删除。此功能很有用,例如,可用于找出 CPU 图中产生尖峰的原因。

 

The Unity Profiler is a tool you can use to get performance information about your application. You can connect it to devices on your network or devices connected to your machine to test how your application runs on your intended release platform. You can also run it in the Editor to get an overview of resource allocation while you’re developing your application.

The Profiler gathers and displays data on the performance of your application in areas such as the CPU, memory, renderer, and audio. It’s a useful tool to identify areas for performance improvement in your application, and iterate on those areas. You can pinpoint things like how your code, assets, scene
settings, camera
rendering
, and build settings affect your application’s performance. It displays the results in a series of charts, so you can visualize where spikes in your application’s performance happen.

In addition to using the built-in Unity Profiler, you can use the low level native plug-in Profiler API to export profiling data to third-party profiling tools, and the Profiling Core package to customize your profiling analysis. You can also add powerful profiling tools such as the Memory Profiler, and the Profile Analyzer to your project to analyze performance data in further detail.

To access the Profiler window go to menu: Window > Analysis > Profiler. For a detailed overview of the window, see the Profiler window documentation.

 

 

 

 

1、这里要注意防火墙不能屏蔽端口:54998-55511

2、确保 adb 连接要测试的 Android 设备

3、如果端口有占用情况,还请解除占用

4、有时候 Unity Profiler 没有反应,可以试着重启 Unity,或者 App

 

1、打开 Unity ,新建一个工程

 

2、简单在场景中,添加一些资源,这里作为简单测试使用

 

3、File - Build Settings ,切换成 Android 平台,并勾选 Development Build ,Autoconnect Profiler,Deep Profiling support (根据需要)

 

4、打包Apk ,然后连接手机,可以使用 adb 把应用安装到手机上

 

5、查看包名,后面可能使用到

 

6、adb forward 指定端口到具体应用上

adb forward tcp:34999 localabstract:Unity-包名

adb forward tcp:34999 localabstract:Unity-com.DefaultCompany.TestAndroidProfile

 

7、如果上面不能出现报错,无法连接

1)输入:adb nodaemon server,发现端口5037已被占用(可能是其他端口

2)输入:netstat –ano | findstr “5037”,查看5037被哪些进程占用

3)输入:taskkill /f /pid 5900(这里是上面查出的进程pid,终止占用5037的进程

4)重新输入 adb forward tcp:34999 localabstract:Unity-包名 在测试

 

8、adb forward  还是不能连接成功,可以 adb kill-server,在 adb start-server ,接着adb forward tcp:34999 localabstract:Unity-包名 在测试

 

9、运行之前手机安装的 Profiler 调试的 App ,然后 Unity 上 Window - Analysis - Profiler

 

10、Profiler 选择 AndroidPlayer(ADB@127.0.0.1:34999),然后就会看到数据运行

 

 

基于 windows 10

1、打开 控制面板

 

2、控制面板,查看类型-大图标,找到 Windows Defender 防火墙,点击打开

 

3、找到 高级设置,点击打开

 

4、找到 入站规则,然后点击 新建规则

 

5、选择端口,点击下一步

 

6、TCP 特定本地端口,54998-55511,下一步

 

7、允许连接,点击下一步

 

8、如图,点击下一步

 

9、填写必要的名称和描述,点击 完成

 

最新文章
如何通过手机远程控制他人手机呢远程控制对方手机「如何通过手机远程控制他人手机呢」
“闻道有先后,术业有专攻”出自唐韩愈《师说》。意思是指所知道的道理有先有后,技能学术各有研究方向。《师说》是唐代文学家韩
时尚亮丽的oppor11 plus手机壳,让你的爱机别具一格oppo手机壳「时尚亮丽的oppor11 plus手机壳,让你的爱机别具一格」
OPPOR11plus手机套 电镀工艺,精美大气的时尚造型,满满的中国风韵味,舒适的手感,搭配亮眼的金龙雄姿个性图案,拿在手里就是很
全能扫描王OCR3.3.7全能扫描王手机版下载「全能扫描王OCR3.3.7」
一款集OCR识别,多种格式,多种语言翻译,去除水印为一体的AI扫描软件,能够直接迅速精确的提取协议合同、照片、书籍、表格中的
桌面宠物无知熊猫加速器手机宠物「桌面宠物无知熊猫加速器」
Get ready to jump into the galaxy and blow up some ships! You are in search of a ship of mythic capabilities... one coul
无线投屏功能在手机、电脑、电视机上怎么找手机镜像功能在哪「无线投屏功能在手机、电脑、电视机上怎么找」
在跟用户介绍无线投屏器的时候,说道miracast投屏,然后用户就问miracast投屏在手机、电脑、电视机上怎么找?本文就为大家科普下
比亚迪进入瑞士市场,首批投放海豹 / 海狮 07EV / 宋 Plus DM-i
IT之家 4 月 5 日消息,据博主 @小迪快报 消息,4 月 2 日,在瑞士举办品牌发布会正式进入瑞士市场。首店在苏黎世班霍夫大街金
我们是怎样被定位的?GPS工作原理解析手机卫星定位「我们是怎样被定位的?GPS工作原理解析」
最近一段时间,关于全球定位系统的话题又火热起来,特别是关于带有定位模块的与专业之间的讨论让持币待购的消费者难以选择。那
OPPO手机卡顿?教你六招快速解决,提升使用体验oppo手机太卡怎么办「OPPO手机卡顿?教你六招快速解决,提升使用体验」
在当今数字时代,智能手机已经成为我们日常生活中不可或缺的一部分,OPPO手机凭借其出色的性能与时尚的设计,吸引了大量用户。然
手机勿扰模式关闭步骤详解手机勿扰模式在哪里「手机勿扰模式关闭步骤详解」
手机勿扰模式怎么关闭大家好,今天我来给大家介绍一下如何关闭手机的勿扰模式。有时候我们可能不小心开启了这项功能,导致无法及
小米手机如何实现与电脑连接小米手机连接电脑「小米手机如何实现与电脑连接」
在现代科技高速发展的时代,智能手机与电脑的连接已经成为我们日常生活和工作中不可或缺的一部分。对于小米手机用户来说,如何高