Unity3D性能消耗分析器

上传人:仙*** 文档编号:100015072 上传时间:2022-06-01 格式:DOC 页数:13 大小:789KB
收藏 版权申诉 举报 下载
Unity3D性能消耗分析器_第1页
第1页 / 共13页
Unity3D性能消耗分析器_第2页
第2页 / 共13页
Unity3D性能消耗分析器_第3页
第3页 / 共13页
资源描述:

《Unity3D性能消耗分析器》由会员分享,可在线阅读,更多相关《Unity3D性能消耗分析器(13页珍藏版)》请在装配图网上搜索。

1、 分析器(仅专业版) Profiler (Pro only)Date:2012-02-25 04:56The Unity Profiler helps you to optimize your game. It reports for you how much time is spent in the various areas of your game. For example, it can report the percentage of time spent rendering, animating or in your game logic.Unity分析器可以帮助你优化你的游戏。它

2、为您报告在你的游戏的各个领域所花费的时间。例如,它可以报告渲染、动画或在你的游戏逻辑花费时间的百分比。You can play your game in the Editor with Profiling on, and it will record performance data. The Profiler window then displays the data in a timeline, so you can see the frames or areas that spike (take more time) than others. By clicking anywhere i

3、n the timeline, the bottom section of the Profiler window will display detailed information for the selected frame.在编辑器中,你可以将你的游戏在分析器运行着的状态下运行,它会记录性能数据。 分析器窗口,在时间轴上显示数据,所以你可以看到帧或区域峰值比其他需要更多的时间。在时间轴中的任何地方按一下,分析器窗口的底部区域会显示选定的帧的详细信息。Note that profiling has to instrument your code. This instrumentation

4、has a small impact on the performance of your game. Typically this overhead is small enough to not affect the game framerate. When using profiling it is typical to consider only the ratio (or percentage) of time spent in certain areas. Also, to improve performance focus on those parts of the game th

5、at consume the most time. pare profiling results before and after code changes and determine the improvements you measure. Sometimes changes you make to improve performance might have a negative effect on frame rate; unexpected consequences of code optimization should be expected.请注意,分析时必须检测你的代码。这检测

6、会对你的游戏性能有小小影响。通常情况下,这种开销是足够小,不会影响游戏的帧率。当使用分析时,它是典型的考虑时间花费在某些领域的比例或百分比。此外,为了提高性能,重点在游戏消耗的时间最多的那些局部。代码更改前后比拟分析结果,并确定您测量的改良。有时,您所做的更改来提高性能,可能对帧速率有负面影响;应预计代码优化的意外的后果。Profiler windowAttaching to Unity players 附加到Unity播放器To profile your game running on an other device or a player running on another puter,

7、 it is possible to connect the editor to that other player. The dropdown Active Profiler will show all players running on the local network. These players are identified by player type and the host name running the player iPhonePlayer (Toms iPhone). To be able to connect to a player, the player must

8、 be launched with the Development Build checkbox found in the Build Settings dialog. From here it is also possible to tick a checkbox to make the Editor and Player Autoconnect at startup.要分析你的游戏运行在其他设备上或者在另一台计算机上运行的播放器,可以连接编辑器到其他播放器。Active Profiler下拉菜单显示在本地网络上运行的所有播放器。这些播放器通过播放器的类型和运行播放器的主机名iPhonePl

9、ayerToms iPhone被识别。要能够连接到一个播放器,播放器必须在 Build Settings对话框中找到Development Build 复选框勾上的情况下打包生成。从这里也可以勾选一个复选框,使编辑器和播放器在启动时自动连接。Profiler Controls 分析器控件Profiler controls are in the toolbar at the top of the window. Use these to turn profiling on and off, navigate through profiled frames and so on. The trans

10、port controls are at the far right end of the toolbar. Note that when the game is running and the profiler is collecting data clicking on any of these transport controls will pause the game. The controls go to the first recorded frame, step one frame back, step one frame forward and go to the last f

11、rame respectively. The profiler does not keep all recorded frames, so the notion of the first frame should really be though of as the oldest frame that is still kept in memory. The current transport button causes the profile statistics window to display data collected in real-time. The Active Profil

12、er popup menu allows you to select whether profiling should be done in the editor or a separate player (for example, a game running on an attached iOS device).分析器控件在窗口顶部的工具栏。使用这些控件翻开和关闭分析,浏览分析好的帧等。传输控件在工具栏的最右端。请注意,当游戏运行、分析器收集数据时,点击任何这些传输控件那两个小箭头将暂停游戏。控件转到记录的第一帧,一步一帧向前(左箭头),一步一帧向后右箭头,分别去到最后一帧。分析器不保存所

13、有记录的帧,因此第一帧的概念,事实上应该是仍然保存在存中的最旧的一帧。 current按钮会使得分析统计窗口显示实时采集的数据。激活分析器Active Profiler弹出菜单让你选择是否应在编辑器或一个或独立播放器进展分析例如,一个游戏运行在iOS设备。Deep Profiling 深度分析When you turn on Deep Profile, all your script code is profiled - that is, all function calls are recorded. This is useful to know where exactly time is

14、spent in your game code.当你翻开深度分析Deep Profile,所有脚本代码将被分析 - 也就是说,所有的函数调用被记录。知道确切在你的游戏代码中花费的时间,这是有用的。Note that Deep Profiling incurs a very large overhead and uses a lot of memory, and as a result your game will run significantly slower while profiling. If you are using plex script code, Deep Profiling

15、 might not be possible at all. Deep profiling should work fast enough for small games with simple scripting. If you find that Deep Profiling for your entire game causes the frame rate to drop so much that the game barely runs, you should consider not using this approach, and instead use the approach

16、 described below. You may find deep profiling more helpful as you are designing your game and deciding how to best implement key features. Note that for large games deep profiling may cause Unity to run out of memory and so for this reason deep profiling may not be possible.注意深度分析Deep Profiling会造成非常

17、大的开销,并使用大量的存,结果你的游戏在分析同时运行明显变慢。如果您使用的是复杂的脚本代码,深度分析可能不会完全有效。深度分析为使用简单的脚本的小游戏工作足够快。如果您发现您的整个游戏在深度分析时运行,导致帧速率下降很多,以至于游戏几乎不能运行,你应该考虑不采用这种方法,而是使用下面描述的方法。您可能会发现深度分析更有利于设计你的游戏,并确定如何最好地实现关键特性。注意深度分析,对于大型游戏可能会导致Unity耗尽存,基于这个原因,深度分析未必有效。Manually profiling blocks of your script code will have a smaller overhea

18、d than using Deep Profiling. Use Profiler.BeginSample and Profiler.EndSample scripting functions to enable and disable profiling around sections of code.手动分析脚本代码块比使用深度分析产生更小的开销。使用Profiler.BeginSample和Profiler.EndSample函数,启用和禁用分析代码段从Profiler.BeginSample 到Profiler.EndSample间的代码。View SyncTime 查看SyncTim

19、eWhen running at a fixed framerate or running in sync with the vertical blank, Unity records the waiting time in Wait For Target FPS. By default this amount of time is not shown in the profiler. To view how much time is spent waiting, you can toggle View SyncTime. This is also a measure of how much

20、headroom you have before losing frames.当运行在一个固定的帧率或带垂直空白同步运行,Unity在Wait For Target FPS记录等待时间,默认情况下,该段时间没有显示在分析器。要查看等待花费多少时间,您可以切换View SyncTime。这也是衡量多少余量你之前丧失帧。Profiler Timeline 分析器时间轴The upper part of the Profiler window displays performance data over time. When you run a game, data is recorded each

21、 frame, and the history of the last several hundred frames is displayed. Clicking on a particular frame will display its details in the lower part of the window. Different details are displayed depending on which timeline area is currently selected.分析器窗口的上部显示随着时间的推移的性能数据。当您运行游戏,每一帧数据被记录,最后那么会显示几百帧的历

22、史。点击一个特定的帧上,该帧的细节将显示在窗口的下部。具体取决于当前选定的时间轴区域显示不同的细节。The vertical scale of the timeline is managed automatically and will attempt to fill the vertical space of the window. Note that to get more detail in say the CPU Usage area you can remove the Memory and Rendering areas. Also, the splitter between th

23、e timeline and the statistics area can be selected and dragged downward to increase the screen area used for the timeline chart.时间轴的垂直刻度是自动管理,并尝试填补窗口的垂直空间。请注意,要获得更多关于CPU的使用率(CPU Usage)的细节,您可以删除存Memory 和渲染Rendering 区域。此外,时间轴和统计区域之间的别离器能被选择和向下拖动,为时间轴图表增加屏幕面积。The timeline consists of several areas: CPU

24、 Usage, Rendering and Memory. These areas can be removed by clicking the close button in the panel, and re-added again using the Add Area drop down in the Profile Controls bar.时间轴包括几个方面:CPU使用率,渲染和存。这些区域可以在面板上按一下关闭按钮删除和 在分析控件Profile Controls工具栏中使用Add Area 下拉菜单再次重新添加。CPU Usage Area CPU使用率 区域The CPU Us

25、age area displays where time is spent in your game. When it is selected, the lower pane displays hierarchical time data for the selected frame.CPU使用率区域显示你的游戏在哪里花费时间。当这个区域被选中,下部窗格中显示选定的帧层次化的时间数据。 Hierarchy mode:Displays hierarchical time data.层级模式Hierarchy mode:显示层次化的时间数据。 Group Hierarchy mode:Groups

26、 time data into logical groups (Rendering, Physics, Scripts etc.). Because children of any group can be in different group (e.g. some script might call rendering functions), the percentages of group times often add up to more than 100%. (This is not a bug.)组层级模式Group Hierarchy mode:成逻辑组的组时间数据渲染Rende

27、ring ,物理Physics,脚本Scripts 等。因为任何组的子成员,可在不同的组例如一些脚本可能调用渲染功能,组时间的百分比往往加起来超过100。 这不是一个错误。 The way the CPU chart is stacked can be reordered by simply dragging chart labels up & down.CPU的使用率(CPU Usage)图表堆叠方式,可以通过简单的上下拖动图表标签进展重新排序。When an item is selected in the lower pane, its contribution to the CPU ch

28、art is highlighted (and the rest are dimmed). Clicking on an item again de-selects it.当在下部窗格中选择一个工程,对应到CPU的使用率(CPU Usage)图表上会高亮显示和其余局部为灰色。再次点击这个工程就会取消选择。Shader.SetPass is selected and its contribution is highlighted in the chart.Shader.SetPass被选中,图表中高亮显示。In the hierarchical time data the self time r

29、efers to the amount of time spent in a particular function not including the time spent calling sub-functions. In the screenshot above, for example 51.2% of time is spent in the Camera.Render function. This function does a lot of work and calls the various drawing and culling functions. Excluding al

30、l these functions only 0.8% of time is spent actually in the Camera.Render function.在分层的时间数据的自我时间self time指花费在特定函数的时间,不包括调用子函数所花费的时间。在上面的截图,例如51.2的时间花费在Camera.Render函数。这个函数做了很多工作,并调用各种绘图和剔除的函数。实际上排除了所有这些功能只有0.8的时间花费在Camera.Render函数。Rendering Area 渲染区域The Rendering area displays rendering statistics.

31、 The Number of Draw Calls, Triangles and Vertices rendered is displayed graphical in the timeline. The Lower pane displays more rendering statistics and these more closely match the ones shown in the GameView Rendering Statistics window.渲染区域显示渲染统计数据。Draw Calls,三角形和顶点渲染数量,在时间轴上显示以图形的方式。下部窗格中显示更多渲染统计数

32、据,这些数据与在游戏视图渲染统计数据窗口显示的数据相匹配。Memory Area 存区域The Memory area displays some memory usage data:存区域显示一些存使用的数据: Total Allocated is the total RAM used by the application. Note that in the Unity Editor this is memory used by everything in the editor; game builds will use much less.总分配Total Allocated 是应用程序所

33、使用的总存。请注意,在Unity编辑器,这是在编辑器中的一切使用的存;游戏构建后将使用少得多的存。 Texture Memory is the amount of video memory used by the textures in the current frame.纹理存(Texture Memory )是在当前帧中纹理占用的显存大小。 Object Count is the total number of Objects that are created. If this number rises over time then it means your game is creati

34、ng some objects that are never destroyed.对象数(Object Count)是所创立的对象的总数。如果这个数字随时间不断上升,那么它意味着你的游戏在不断创造一些从不销毁的对象。 Audio Area 音频区域The Audio area displays audio statistics:音频区域显示音频统计数据: Playing Sources is the total playing sources in the scene at a specific frame. Monitor this to see if audio is overloaded

35、.播放源Playing Sources是在特定的帧,场景上播放源的总数。监视此,看看音频是否被重载。 Paused Sources is the total paused sources in the scene at a specific frame.暂停源Paused Sources 是在特定的帧,场景上暂停源的总数。 Audio Voice is the actually number of audio (FMOD channels) voices used. PlayOneShot is using voices not shown in Playing Sources.音频声音Aud

36、io Voice是实际使用音频FMOD频道声音的数量。 PlayOneShot使用的是不会显示在播放源Playing Sources的声音。 Audio Memory is the total RAM used by the audio engine.音频存Audio Memory 音频引擎所使用的存总量。 CPU usage can be seen in the bottom. Monitor this to see if Audio alone is taking up too much CPU.在底部可见的CPU使用率。监察这,看看音频是否单独占用太多的CPU。Physics Area

37、物理学区域The Physics area shows the following statistics about the physics in the scene:-物理学区域显示以下有关场景物理学的统计: Active Rigidbodies is the number of rigidbodies that are not currently sleeping (ie, they are moving or just ing to rest).Active Rigidbodies是指当前活动的刚体数也就是说,他们正移动或仅刚刚静止。 Sleeping Rigidbodies is th

38、e number of rigidbodies that are pletely at rest and therefore dont need to be updated actively by the physics engine (see Rigidbody Sleeping for further details).Sleeping Rigidbodies是指哪些静止的刚体数,因此,不需要物理引擎主动更新(详情参见Rigidbody Sleeping)。 Number of Contacts is the total number of points of contact betwee

39、n all colliders in the scene.Number of Contacts接触点数是指场景中的所有接触点的总数。 Static Colliders is the number of colliders attached to non-rigidbody objects (ie, objects which never move under physics).Static Colliders静态碰撞器是指附加到非刚体物体的碰撞器数量也就是说,物体从来不会在物理作用下移动。 Dynamic Colliders is the number of colliders attache

40、d to rigidbody objects (ie, objects which do move under physics).Dynamic Colliders动态碰撞器是指附加到刚体物体的碰撞器数量也就是说,物体可以在物理的作用下移动。GPU Area GPU区域The GPU profiler is similar to the CPU profiler with the various contributions to rendering time shown as a hierarchy in the bottom panel. Selecting an item from the

41、 hierarchy will show a breakdown in the panel to the right.GPU分析器类似于CPU分析器,关于渲染时间的不同奉献,在底部面板作为层级显示。从层级选择的工程会显示在右边的面板细分。Please note that on the Mac, GPU profiling is only available under OSX 10.7 Lion and later versions.请注意在Mac,GPU分析器仅在OSX 10.7 Lion或更高版本可用。See Also 参见 Optimizing Graphics Performancep

42、age.优化图形性能页面iOSRemote profiling can be enabled on iOS devices by following these steps:iOS设备上启用远程分析可以通过以下步骤:1 Connect your iOS device to your WiFi network (local/adhoc WiFi network is used by profiler to send profiling data from device to the Unity Editor).您的iOS设备连接到WiFi网络分析器使用本地/adhoc WiFi网络发送分析数据,

43、从设备到Unity的编辑器。 2 Check Autoconnect Profiler checkbox in Unitys build settings dialog.在Unity的构建立置build settings对话框中的,勾上复选框自动连接分析器Autoconnect Profiler。 3 Attach your device to your Mac via cable and hit Build & Run in Unity Editor.通过数据线将您的设备连接到你的Mac,在Unity编辑器中点击Build Run。 4 When app launches on device

44、 open profiler window in Unity Editor (Window-Profiler)当应用程序在设备上启动,在Unity的编辑器翻开分析器窗口Window-Profiler If you are using a firewall, you need to make sure that ports 54998 to 55511 are open in the firewalls outbound rules - these are the ports used by Unity for remote profiling.如果使用了防火墙,你必须确保端口54998 到 5

45、5511在防火墙的出站规那么被翻开。这些端口都是Unity远程分析要使用的端口。Note: Sometimes Unity Editor might not autoconnect to the device. In such cases profiler connection might be initiated from Profiler Window Active Profiler drop down menu by select appropriate device.注:有时,在Unity的编辑器可能不会自动连接到该设备。在这种情况下,在分析器窗口的Active Profiler下拉菜

46、单项选择择相应的设备,分析器连接可以主动发起。AndroidRemote profiling can be enabled on Android devices through two different paths : WiFi or ADB.远程分析可以在Android设备通过两种不同的途径启用:WiFi或ADB。For WiFi profiling, follow these steps:对于WiFi分析,用以下的这些步骤:5 Make sure to disable Mobile Data on your Android device.确保在Andriod设备禁用手机数据。6 Conn

47、ect your Android device to your WiFi network.连接Android设备到你的Wifi网络。7 Check the Autoconnect Profiler checkbox in Unitys build settings dialog.在Unity编译设置对话框,检查Autoconnect Profiler复选框是否勾选。8 Attach your device to your Mac/PC via cable and hit Build & Run in Unity Editor.通过数据线连接你的设备到电脑,在Unity点击Build & Run

48、。9 When the app launches on the device, open the profiler window in Unity Editor (Window-Profiler)当应用程序在设备上启动,在Unity翻开分析器窗口Window-Profiler。10 If the Unity Editor fails to autoconnect to the device, select the appropriate device from the Profiler Window Active Profiler drop down menu.如果Unity无法自动连接到该设

49、备,从分析器窗口Active Profiler下拉菜单,选择相应的设备。Note: The Android device and host puter (running the Unity Editor) must both be on the same subnet for the device detection to work.注意:Android设备和主机计算机正运行Unity必须两者在同一子网,才能正常运行设备检测工作。For ADB profiling, follow these steps:对于ADB分析,用以下的这些步骤: Attach your device to your

50、Mac/PC via cable and make sure ADB recognizes the device (i.e. it shows in adb devices list).通过数据线连接设备到电脑,并确保ADB设备设备也就是说它显示在ADB设备列表。 Open a Terminal window / CMD prompt and enter翻开一个终端窗口/ CMD提示符并输入adb forward tcp:54999 localabstract:Unity- Check the Development Build checkbox in Unitys build setting

51、s dialog, and hit Build & Run.在Unity编译设置对话框,检查Development Build复选框是否勾选,并点击Build & Run。 When the app launches on the device, open the profiler window in Unity Editor (Window-Profiler)当应用程序在设备上启动,在Unity翻开分析器窗口Window-Profiler。 Select the AndroidProfiler(ADB127.0.0.1:54999) from the Profiler Window Acti

52、ve Profiler drop down menu.从分析器窗口Active Profiler下拉菜单项选择择AndroidProfiler(ADB127.0.0.1:54999)Note: The entry in the drop down menu is only visible when the selected target is Android.注意:进入下拉菜单,中选择目标是Android唯一可见时选择。If you are using a firewall, you need to make sure that ports 54998 to 55511 are open in the firewalls outbound rules - these are the ports used by Unity for remote profiling.如果使用了防火墙,你必须确保端口54998 到 55511在防火墙的出站规那么被翻开。这些端口都是Unity远程分析要使用的端口。13 / 13

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!