【正文】
分析器(僅專業(yè)版) Profiler (Pro only)Date:20120225 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分析器可以幫助你優(yōu)化你的游戲。它為您報告在你的游戲的各個領(lǐng)域所花費的時間。例如,它可以報告渲染、動畫或在你的游戲邏輯花費時間的百分比。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 in the timeline, the bottom section of the Profiler window will display detailed information for the selected frame.在編輯器中,你可以將你的游戲在分析器運行著的狀態(tài)下運行,它會記錄性能數(shù)據(jù)。 分析器窗口,在時間軸上顯示數(shù)據(jù),所以你可以看到幀或區(qū)域峰值(比其他需要更多的時間)。在時間軸中的任何地方按一下,分析器窗口的底部區(qū)域會顯示選定的幀的詳細信息。Note that profiling has to instrument your code. This instrumentation 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 that consume the most time. Compare 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.請注意,分析時必須檢測你的代碼。這檢測會對你的游戲性能有小小影響。通常情況下,這種開銷是足夠小,不會影響游戲的幀率。當使用分析時,它是典型的考慮時間花費在某些領(lǐng)域的比例(或百分比)。此外,為了提高性能,重點在游戲消耗的時間最多的那些部分。代碼更改前后比較分析結(jié)果,并確定您測量的改進。有時,您所做的更改來提高性能,可能對幀速率有負面影響。應預計代碼優(yōu)化的意外的后果。Profiler windowAttaching to Unity players 附加到Unity播放器To profile your game running on an other device or a player running on another puter, 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 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.要分析你的游戲運行在其他設(shè)備上或者在另一臺計算機上運行的播放器,可以連接編輯器到其他播放器。Active Profiler下拉菜單顯示在本地網(wǎng)絡(luò)上運行的所有播放器。這些播放器通過播放器的類型和運行播放器的主機名iPhonePlayer(Toms 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 transport 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 frame 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 m