分享好友 最新资讯首页 最新资讯分类 切换频道
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、填写必要的名称和描述,点击 完成

 

最新文章
苹果数据线横评 到底要怎样才能选出一款好的数据线手机显示充电但是充不进去怎么办「苹果数据线横评 到底要怎样才能选出一款好的数据线」
  【PConline 横评】苹果手机娇贵这件事不是一天两天了,苹果手机好用,性能强劲,但是苹果手机娇贵这件事确实是不争的事实。
苹果怎么改苹果手机怎么设置「苹果怎么改」
当我们拿到一部全新的iPhone时,除了其卓越的性能和精美的设计外,如何根据个人喜好进行个性化设置也是每位用户关注的焦点。接下
不睡在一张床上的,都是空巢情侣没有手机的日子「不睡在一张床上的,都是空巢情侣」
Party MonsterThe Weeknd - Starboy一个人去医院本来也没什么要紧,但打着点滴被通知家属缴费的时候,还是心酸。深夜加班回到家
东方财富终端东方手机财富网「东方财富终端」
  DDE决策怎么看?  DDE决策系统采用最先进的“云计算”技术,实时整合沪深高速行情及成交数据,通过海量运算和智能统计构建
ipad内存不够怎么扩充手机内存不够怎么清理「ipad内存不够怎么扩充」
iPad作为苹果公司的明星产品,凭借其出色的性能和便捷的操作赢得了众多用户的喜爱。然而,随着使用时间的增长,不少用户都会遇到
5G手机争霸战:降价、微距拍摄轰炸,能提振销售吗?手机轰炸「5G手机争霸战:降价、微距拍摄轰炸,能提振销售吗?」
  中新网客户端北京4月9日电(记者 吴涛)近日,一批新款5G手机开售,价格也不断触底。去年5G手机上万元的消息让人难以忘记,现
3299元的骁龙8Gen3手机?红米K70 Pro:狠起来连小米14都不放过红米3手机「3299元的骁龙8Gen3手机?红米K70 Pro:狠起来连小米14都不放过」
谁能想到,就在小米14系列首发骁龙8Gen3后不久,红米K70Pro也正式宣布搭载骁龙8Gen3,并于11月29日19:00发布,而且这次产品力将
iphone连接电脑无反应 原因有哪些苹果手机连电脑「iphone连接电脑无反应 原因有哪些」
  iPhone手机在全球都得到了广泛的认可,而且受到了青少年以及中年人群的强烈欢迎。很多人在使用iPhone手机的时候,都会遇到各
【原】苹果手机怎么分屏?苹果手机如何分屏「【原】苹果手机怎么分屏?」
分屏是很常见的手机功能,手机的分屏功能为用户提供了更加便捷的操作体验,使用户能够更好地进行多任务处理,提高工作效率。例如
如何还原记事本中已删除的内容手机记事本「如何还原记事本中已删除的内容」
记事本是很多人在使用的生活和工作辅助工具,手机和电脑上都可以使用。电脑上有自带的记事本功能;手机上即便没有记事本,也有便