




已閱讀5頁,還剩8頁未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
精品文檔分析器(僅專業(yè)版) 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分析器可以幫助你優(yōu)化你的游戲。它為您報告在你的游戲的各個領(lǐng)域所花費(fèi)的時間。例如,它可以報告渲染、動畫或在你的游戲邏輯花費(fèi)時間的百分比。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.在編輯器中,你可以將你的游戲在分析器運(yùn)行著的狀態(tài)下運(yùn)行,它會記錄性能數(shù)據(jù)。 分析器窗口,在時間軸上顯示數(shù)據(jù),所以你可以看到幀或區(qū)域峰值(比其他需要更多的時間)。在時間軸中的任何地方按一下,分析器窗口的底部區(qū)域會顯示選定的幀的詳細(xì)信息。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.請注意,分析時必須檢測你的代碼。這檢測會對你的游戲性能有小小影響。通常情況下,這種開銷是足夠小,不會影響游戲的幀率。當(dāng)使用分析時,它是典型的考慮時間花費(fèi)在某些領(lǐng)域的比例(或百分比)。此外,為了提高性能,重點(diǎn)在游戲消耗的時間最多的那些部分。代碼更改前后比較分析結(jié)果,并確定您測量的改進(jìn)。有時,您所做的更改來提高性能,可能對幀速率有負(fù)面影響;應(yīng)預(yù)計(jì)代碼優(yōu)化的意外的后果。Profiler windowAttaching to Unity players 附加到Unity播放器To profile your game running on an other device or a player running on another computer, 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.要分析你的游戲運(yùn)行在其他設(shè)備上或者在另一臺計(jì)算機(jī)上運(yùn)行的播放器,可以連接編輯器到其他播放器。Active Profiler下拉菜單顯示在本地網(wǎng)絡(luò)上運(yùn)行的所有播放器。這些播放器通過播放器的類型和運(yùn)行播放器的主機(jī)名iPhonePlayer(Toms iPhone)被識別。要能夠連接到一個播放器,播放器必須在 Build Settings對話框中找到Development Build 復(fù)選框勾上的情況下打包生成。從這里也可以勾選一個復(fù)選框,使編輯器和播放器在啟動時自動連接。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 memory. The current transport button causes the profile statistics window to display data collected in real-time. The Active Profiler 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).分析器控件在窗口頂部的工具欄。使用這些控件打開和關(guān)閉分析,瀏覽分析好的幀等。傳輸控件在工具欄的最右端。請注意,當(dāng)游戲運(yùn)行、分析器收集數(shù)據(jù)時,點(diǎn)擊任何這些傳輸控件(那兩個小箭頭)將暫停游戲??丶D(zhuǎn)到記錄的第一幀,一步一幀向前(左箭頭),一步一幀向后(右箭頭),分別去到最后一幀。分析器不保留所有記錄的幀,因此第一幀的概念,事實(shí)上應(yīng)該是仍然保存在內(nèi)存中的最舊的一幀。 current按鈕會使得分析統(tǒng)計(jì)窗口顯示實(shí)時采集的數(shù)據(jù)。激活分析器(Active Profiler)彈出菜單讓你選擇是否應(yīng)在編輯器或一個或獨(dú)立播放器進(jìn)行分析(例如,一個游戲運(yùn)行在iOS設(shè)備)。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 spent in your game code.當(dāng)你打開深度分析(Deep Profile),所有腳本代碼將被分析 - 也就是說,所有的函數(shù)調(diào)用被記錄。知道確切在你的游戲代碼中花費(fèi)的時間,這是有用的。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 complex script code, Deep Profiling 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 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)會造成非常大的開銷,并使用大量的內(nèi)存,結(jié)果你的游戲在分析同時運(yùn)行明顯變慢。如果您使用的是復(fù)雜的腳本代碼,深度分析可能不會完全有效。深度分析為使用簡單的腳本的小游戲工作足夠快。如果您發(fā)現(xiàn)您的整個游戲在深度分析時運(yùn)行,導(dǎo)致幀速率下降很多,以至于游戲幾乎不能運(yùn)行,你應(yīng)該考慮不采用這種方法,而是使用下面描述的方法。您可能會發(fā)現(xiàn)深度分析更有利于設(shè)計(jì)你的游戲,并確定如何最好地實(shí)現(xiàn)關(guān)鍵特性。注意深度分析,對于大型游戲可能會導(dǎo)致Unity耗盡內(nèi)存,基于這個原因,深度分析未必有效。Manually profiling blocks of your script code will have a smaller overhead than using Deep Profiling. Use Profiler.BeginSample and Profiler.EndSample scripting functions to enable and disable profiling around sections of code.手動分析腳本代碼塊比使用深度分析產(chǎn)生更小的開銷。使用Profiler.BeginSample和Profiler.EndSample函數(shù),啟用和禁用分析代碼段(從Profiler.BeginSample 到Profiler.EndSample間的代碼)。View SyncTime 查看SyncTimeWhen 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 headroom you have before losing frames.當(dāng)運(yùn)行在一個固定的幀率或帶垂直空白同步運(yùn)行,Unity在Wait For Target FPS記錄等待時間,默認(rèn)情況下,該段時間沒有顯示在分析器。要查看等待花費(fèi)多少時間,您可以切換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 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.分析器窗口的上部顯示隨著時間的推移的性能數(shù)據(jù)。當(dāng)您運(yùn)行游戲,每一幀數(shù)據(jù)被記錄,最后則會顯示幾百幀的歷史。點(diǎn)擊一個特定的幀上,該幀的細(xì)節(jié)將顯示在窗口的下部。具體取決于當(dāng)前選定的時間軸區(qū)域顯示不同的細(xì)節(jié)。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 the timeline and the statistics area can be selected and dragged downward to increase the screen area used for the timeline chart.時間軸的垂直刻度是自動管理,并嘗試填補(bǔ)窗口的垂直空間。請注意,要獲得更多關(guān)于CPU的使用率(CPU Usage)的細(xì)節(jié),您可以刪除內(nèi)存(Memory )和渲染(Rendering )區(qū)域。此外,時間軸和統(tǒng)計(jì)區(qū)域之間的分離器能被選擇和向下拖動,為時間軸圖表增加屏幕面積。The timeline consists of several areas: CPU 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使用率,渲染和內(nèi)存。這些區(qū)域可以在面板上按一下關(guān)閉按鈕刪除和 在分析控件(Profile Controls)工具欄中使用Add Area 下拉菜單再次重新添加。CPU Usage Area (CPU使用率 區(qū)域)The CPU Usage 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使用率區(qū)域顯示你的游戲在哪里花費(fèi)時間。當(dāng)這個區(qū)域被選中,下部窗格中顯示選定的幀層次化的時間數(shù)據(jù)。 Hierarchy mode:Displays hierarchical time data.層級模式(Hierarchy mode):顯示層次化的時間數(shù)據(jù)。 Group Hierarchy mode:Groups 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):成邏輯組的組時間數(shù)據(jù)(渲染(Rendering ),物理(Physics),腳本(Scripts )等)。因?yàn)槿魏谓M的子成員,可在不同的組(例如一些腳本可能調(diào)用渲染功能),組時間的百分比往往加起來超過100。 (這不是一個錯誤。) The way the CPU chart is stacked can be reordered by simply dragging chart labels up & down.CPU的使用率(CPU Usage)圖表堆疊方式,可以通過簡單的上下拖動圖表標(biāo)簽進(jìn)行重新排序。When an item is selected in the lower pane, its contribution to the CPU chart is highlighted (and the rest are dimmed). Clicking on an item again de-selects it.當(dāng)在下部窗格中選擇一個項(xiàng)目,對應(yīng)到CPU的使用率(CPU Usage)圖表上會高亮顯示(和其余部分為灰色)。再次點(diǎn)擊這個項(xiàng)目就會取消選擇。Shader.SetPass is selected and its contribution is highlighted in the chart.Shader.SetPass被選中,圖表中高亮顯示。In the hierarchical time data the self time refers 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 all these functions only 0.8% of time is spent actually in the Camera.Render function.在分層的時間數(shù)據(jù)的自我時間(self time)指花費(fèi)在特定函數(shù)的時間,不包括調(diào)用子函數(shù)所花費(fèi)的時間。在上面的截圖,例如51.2的時間花費(fèi)在Camera.Render函數(shù)。這個函數(shù)做了很多工作,并調(diào)用各種繪圖和剔除的函數(shù)。實(shí)際上排除了所有這些功能只有0.8的時間花費(fèi)在Camera.Render函數(shù)。Rendering Area 渲染區(qū)域The Rendering area displays rendering statistics. 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.渲染區(qū)域顯示渲染統(tǒng)計(jì)數(shù)據(jù)。Draw Calls,三角形和頂點(diǎn)渲染數(shù)量,在時間軸上顯示以圖形的方式。下部窗格中顯示更多渲染統(tǒng)計(jì)數(shù)據(jù),這些數(shù)據(jù)與在游戲視圖渲染統(tǒng)計(jì)數(shù)據(jù)窗口顯示的數(shù)據(jù)相匹配。Memory Area 內(nèi)存區(qū)域The Memory area displays some memory usage data:內(nèi)存區(qū)域顯示一些內(nèi)存使用的數(shù)據(jù): 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 )是應(yīng)用程序所使用的總內(nèi)存。請注意,在Unity編輯器,這是在編輯器中的一切使用的內(nèi)存;游戲構(gòu)建后將使用少得多的內(nèi)存。 Texture Memory is the amount of video memory used by the textures in the current frame.紋理內(nèi)存(Texture Memory )是在當(dāng)前幀中紋理占用的顯存大小。 Object Count is the total number of Objects that are created. If this number rises over time then it means your game is creating some objects that are never destroyed.對象數(shù)(Object Count)是所創(chuàng)建的對象的總數(shù)。如果這個數(shù)字隨時間不斷上升,那么它意味著你的游戲在不斷創(chuàng)造一些從不銷毀的對象。 Audio Area 音頻區(qū)域The Audio area displays audio statistics:音頻區(qū)域顯示音頻統(tǒng)計(jì)數(shù)據(jù): Playing Sources is the total playing sources in the scene at a specific frame. Monitor this to see if audio is overloaded.播放源(Playing Sources)是在特定的幀,場景上播放源的總數(shù)。監(jiān)視此,看看音頻是否被重載。 Paused Sources is the total paused sources in the scene at a specific frame.暫停源(Paused Sources )是在特定的幀,場景上暫停源的總數(shù)。 Audio Voice is the actually number of audio (FMOD channels) voices used. PlayOneShot is using voices not shown in Playing Sources.音頻聲音(Audio Voice)是實(shí)際使用音頻(FMOD頻道)聲音的數(shù)量。 PlayOneShot使用的是不會顯示在播放源(Playing Sources)的聲音。 Audio Memory is the total RAM used by the audio engine.音頻內(nèi)存(Audio Memory )音頻引擎所使用的內(nèi)存總量。 CPU usage can be seen in the bottom. Monitor this to see if Audio alone is taking up too much CPU.在底部可見的CPU使用率。監(jiān)察這,看看音頻是否單獨(dú)占用太多的CPU。Physics Area 物理學(xué)區(qū)域The Physics area shows the following statistics about the physics in the scene:-物理學(xué)區(qū)域顯示下列有關(guān)場景物理學(xué)的統(tǒng)計(jì): Active Rigidbodies is the number of rigidbodies that are not currently sleeping (ie, they are moving or just coming to rest).Active Rigidbodies是指當(dāng)前活動的剛體數(shù)(也就是說,他們正移動或僅剛剛靜止)。 Sleeping Rigidbodies is the number of rigidbodies that are completely at rest and therefore dont need to be updated actively by the physics engine (see Rigidbody Sleeping for further details).Sleeping Rigidbodies是指哪些靜止的剛體數(shù),因此,不需要物理引擎主動更新(詳情參見Rigidbody Sleeping)。 Number of Contacts is the total number of points of contact between all colliders in the scene.Number of Contacts(接觸點(diǎn)數(shù))是指場景中的所有接觸點(diǎn)的總數(shù)。 Static Colliders is the number of colliders attached to non-rigidbody objects (ie, objects which never move under physics).Static Colliders(靜態(tài)碰撞器)是指附加到非剛體物體的碰撞器數(shù)量(也就是說,物體從來不會在物理作用下移動)。 Dynamic Colliders is the number of colliders attached to rigidbody objects (ie, objects which do move under physics).Dynamic Colliders(動態(tài)碰撞器)是指附加到剛體物體的碰撞器數(shù)量(也就是說,物體可以在物理的作用下移動)。GPU Area (GPU區(qū)域)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 hierarchy will show a breakdown in the panel to the right.GPU分析器類似于CPU分析器,關(guān)于渲染時間的不同貢獻(xiàn),在底部面板作為層級顯示。從層級選擇的項(xiàng)目會顯示在右邊的面板細(xì)分。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 Performancepage.優(yōu)化圖形性能頁面iOSRemote profiling can be enabled on iOS devices by following these steps:iOS設(shè)備上啟用遠(yuǎn)程分析可以通過以下步驟: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設(shè)備連接到WiFi網(wǎng)絡(luò)(分析器使用本地/adhoc WiFi網(wǎng)絡(luò)發(fā)送分析數(shù)據(jù),從設(shè)備到Unity的編輯器)。 2 Check Autoconnect Profiler checkbox in Unitys build settings dialog.在Unity的構(gòu)建設(shè)置(build settings)對話框中的,勾上復(fù)選框自動連接分析器(Autoconnect Profiler)。 3 Attach your device to your Mac via cable and hit Build & Run in Unity Editor.通過數(shù)據(jù)線將您的設(shè)備連接到你的Mac,在Unity編輯器中點(diǎn)擊Build Run。 4 When app launches on device open profiler window in Unity Editor (Window-Profiler)當(dāng)應(yīng)用程序在設(shè)備上啟動,在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 到 55511在防火墻的出站規(guī)則被打開。這些端口都是Unity遠(yuǎn)程分析要使用的端口。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的編輯器可能不會自動連接到該設(shè)備。在這種情況下,在分析器窗口的Active Profiler下拉菜單選擇相應(yīng)的設(shè)備,分析器連接可以主動發(fā)起。AndroidRemote profiling can be enabled on Android devices through two different paths : WiFi or ADB.遠(yuǎn)程分析可以在Android設(shè)備通過兩種不同的途徑啟用:WiFi或ADB。For WiFi profiling, follow these steps:對于WiFi分析,用下列的這些步驟:5 Make sure to disable Mobile Data on your Android device.確保在Andriod設(shè)備禁用手機(jī)數(shù)據(jù)。6 Connect your Android device to your WiFi network.連接Android設(shè)備到你的Wifi網(wǎng)絡(luò)。7 Check the Autoconnect Profiler checkbox in Unitys build settings dialog.在Unity編譯設(shè)置對話框,檢查Autoconnect Profiler復(fù)選框是否勾選。8 Attach your device to your Mac/PC via cable and hit Build & Run in Unity Editor.通過數(shù)據(jù)線連接你的設(shè)備到電腦,在Unity點(diǎn)擊Build & Run。9 When the app launches on the device, open the profiler window in Unity
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- BIM在施工成本控制中的案例
- 小學(xué)三年級數(shù)學(xué)100以內(nèi)整數(shù)除法計(jì)算水平檢測練習(xí)題帶答案
- 高一英語閱讀技巧與實(shí)戰(zhàn)演練
- 克服困難的故事寫人作文14篇
- 《中國傳統(tǒng)文化的主要特點(diǎn):高中語文文化教案》
- 論科學(xué)與藝術(shù)之美:高中語文閱讀拓展課程教案
- 合流型三通調(diào)節(jié)閥交匯流流動特性研究
- 藝術(shù)欣賞與創(chuàng)作-高中美術(shù)鑒賞課教案設(shè)計(jì)
- 丘陵山地甘蔗割鋪機(jī)電控系統(tǒng)設(shè)計(jì)與研究
- 我的成長演講稿關(guān)于勵志的話題8篇
- 《血管活性藥物靜脈輸注護(hù)理》團(tuán)體標(biāo)準(zhǔn)解讀
- 《數(shù)字通信原理》課件 項(xiàng)目一-認(rèn)識通信系統(tǒng)
- 海洋環(huán)境監(jiān)測
- 第四單元《學(xué)會學(xué)習(xí)終身受益》測試卷-高一思想政治課《心理健康與職業(yè)生涯》附答案
- 五年(2020-2024)高考物理真題分類匯編 專題01 力與物體的平衡(解析版)
- 校園超市投標(biāo)書
- 生成式人工智能增強(qiáng)學(xué)科教學(xué)適應(yīng)性的邏輯理路與實(shí)踐路徑
- 腹主動脈瘤的護(hù)理查房
- 歐洲文明的現(xiàn)代歷程學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
- 年產(chǎn)60萬臺(套)新能源汽車充電樁項(xiàng)目可行性研究報告寫作模板-拿地申報
- 醫(yī)務(wù)人員依法執(zhí)業(yè)測試試題
評論
0/150
提交評論