Unity3D性能消耗分析器.docx
Teverticalscaleofthetimelineismanagedautomaticallyandwillattempttofilltheverticalspaceofthewindow.NotethattogetmoredetailinsaytheCPUUsageareayoucanremovetheMemoryandRenderingareas.Also,thesplitterbetweenthetimelineandthestatisticsareacanbeselectedanddraggeddownwardtoincreasethescreenareausedforthetimelinechart.时间轴的垂H刻度足自动行理,并尝试填补河口的车收吃间.请留意.卷狭和变为关于CPU的运用率(CPUUSage)的细微环小魅可以刮除内存'Memory)和渲染(Rendering)区域.此外.时间柏和统计区域之向的别离辖能战选卦和向下拖功,为时间轴图表增加屏窑面积.Thetimelineconsistsofseveralareas:CPUUsagezRenderingandMemory.Theseareascanberemovedbyclickingtheclosebuttoninthepanel,andre-addedagainusingtheAddAreadropdownintheProbar.时何知包括几个方面:CPU运用也池案和内行,这些区域可以在面板上C吓关闭按机切除和在分析控件(Pro)工具栏中运用AddArea下拉菜单再次正新添加,CPUUsageArea(CPU运用率区域)<5Profiler14.2%1.6%0.7%0.0%11.3%6.7%6.4%5.6%0.4%DrawingCullingCUITexcRenderCameraJmAgeEFfectsMeshSkInningOverheadFueicellGlow1.ookAt.UpdateOObjcctRotater.Update<)AGU1.RePaIm47.1%l.7%1.4%0.0%11.3%6.7%6.4%S.6%3.5%2OB2OB2OB2OB1OB1OB33264B46OB12.1KBS30.l0.1.0.0120.70.70.60.4TheCPUUsageareadisplayswheretimeisspentinyourgame.When及Isselected,thelowerpanedisplayshierarchicaltimedatafortheselectedframe.CPU应用率区域显示你的嬉戏在照里花明时间当这个M城被i中.卜部由格中域东选定的M房次化的时何数据Hierarchymode:DiSPIayShierarchicaltimedata.层级模式IHJerarchymodeh必求层次化的时间数据.GroupHierarchymode:Groupstimedataintologicalgroups(Rendering,Physics,Scriptsetc.).Becausechildrenofanygroupcanbeindifferentgroup(e.g.somescriptmightcallrenderingfunctions),thepercentagesofgrouptimesoftenadduptomorethan100%.(Thisisnotabug.)祖层线梭式(GroupHierarchymode)成设M组的组时间数据:涓染Rendering物理(Physics).M*(ScriptsI等)因为任何IB的子成员,可在不同的阻(例如一些脚本可能调用Ia派功健)组时何的百分比往(E加起来招过100%,(这不是一个锚误TewaytheCPUchartisstackedcanbereorderedbysimplydraggingchartlabelsup&down.CPUftll<.(CPUUSage)图去堆用方式.%以辿过前洁的卜卜拖动身表标笠进展贸新排库.Whenanitemisselectedinthelowerpane,it'scontributiontotheCPUchartishighlighted(andtherestaredimmed).Oickingonanitemagainde-selectsit.当在下部河格中选择个工程,对应到CPU的运用军(CPUUSagC)图改上会滞亮显不(和北余只郃为灰色;.内次点击这个工程就公取消选择.(ProfilerHierarchyIFunctionTotalSelfCallsMemoryTimemsCamcra.RenderS12%0.8%2OB5.7Drawing47.1%14.2%2OB53>MeshRenderer.Render15.6%1.2%6SOB1.7Shade1.Sctfass1S.O1S.O78OBASkinnedMeshRenderer.Render1.2%0.0%6OB0.1ParticIcRcnderer.Render1.0%0.S%1OB0.1.Cullingl.7%1.6%2OB0.1CUITexcRender1.4%0.7%2OB0.1.CamerdJmageEffects0.0%0.0X2OB0.0MeshSkinning113%11.3%1OB12Shader.SetPassIsselectedandit'scontributionIshighlightedinthechart.ShadenSetPassWii.图表中高亮显示。Inthehierarchicaltimedatatheselftimereferstotheamountoftimespentinaparticularfunctionnotincludingthetimespentcallingsub-functions.Inthescreenshotabove,forexample51.2%oftimeIsspentIntheCamera.Renderfunction.ThisfunctiondoesaIOCOfworkandcallsthevariousdrawingandcullingfunctions.Excludingallthesefunctionsonly0.8%oftimeisspentactuallyintheCamera.Renderfunction.在分层的时间攻幅的自我时间(selftimeI折花费在特定南攻的时间.不包括得Mf由攻所花费的时同.aI为的故图,例如51.2%的时何佗货4Camera.RenderhR,这个函数做门午多工作.并调用各种绘图和剔除的由数,%实上解除了全部这些功能只行0.8%的时间花我在Camera.Render函数RenderingArea沮染区域DrawCalls:1Tris:760Verts:525BatchedDrawCaIIs:0BatchedTris:0hatchedVerts:0UsedTextures:1/08RenderTextures0/0BRendcrTcxtureSwitches0Screen:632x3S0I2.5M8VRAMusage:2.5MBto2.7MB(of2S6.0MB)VBOTotal:36-170.1KBVBUpIoads:0-0BIBUpIoads:0-0BShadowCaster»0VisibleSkinnedMcshes0Animations.0TheRenderingareadisplaysrenderingstatistics.TheNumberofDrawCalls,TnanglesandVerticesrenderedisdisplayedgraphicalinthetimeline.The1.owerpanedisplaysmorerenderingstatisticsandthesemorecloselymatchtheonesshownintheGameViewRenderingStatisticswindow.泊染区域品示泣案统il数据-DrawCalls,角形和顶点泊及双T花时向柏匕隘示以图形的方式,下都窗格中显示史方演染统计数据,这些数据与在她成视图消柒统if*数据«111显示的数据相P1.配.MemoryArea内存区域<ProfilerMemory:Total:260.2M8Delta0BTextures:62S/18.8MBMeshes:S4/7.9MBAnimationCIips:25/0.6MBTotalObjectCount:6537TheMemoryareadisplayssomememoryusagedata:内存区域H示一些内在送M的数据: TotalAllocatedisthetotalRAMusedbytheapplication.NotethatintheUnityEditorthisismemoryusedbyeverythingintheeditor;gamebuildswillusemuchless.a!f(TotalAllocated)是一用程序所运用的总内存请留意.ftUnityittflIX1.这是在编新JS中的一切运用的内存洌戏构建后将运用少得多的内存. TextureMemoryistheamountofvideomemoryusedbythetexturesinthecurrentframe.奴理内存(TeXtUreMemory)是在与的懂中税理占用的&存大小. ObjectCountisthetotalnumberofObjectsthatarecreated.Ifthisnumberrisesovertimethenitmeansyourgameiscreatingsomeobjectsthatareneverdestroyed.对发数(ObjeaC。Unt)是所创立的对象的散.但切这个数字的时间不独上升,那么它造味帚你的焙戏在不断创建一些从不销发的对阪,AudioArea音频区域(!>ProfilerAddProfilerlAudioS,力J1.VWgSourcesClRausfdSourcesUAUdK)VoicesAudioMemorPlayingSources:OPausedSourcesiOAudioVoicesiOAudloCPUUsage:0.1%AudioMemory:285.0KBMaxAudioMemoryUsage:285.0KBTheAudioareadisplaysaudiostatistics:齐顿区域H示音频统计iIK: PlayingSourcesisthetotalplayingsourcesinthesceneataspecificframe.Monitorthistoseeifaudioisoverloaded.播放源PlayingSources)是在特定的Mb场跟上播放源的总®(监视此仆方官或是否被IUh PausedSourcesisthetotalpausedsourcesinthesceneataspecificframe.号件源:PausedSourcesJ处在特定的棘.场疑上苦停课的总数 AudioVoiceistheactuallynumberofaudio(FMODchannels)voicesused.PlayOneShotsusingvoicesnotshownInPlayingSources.书嫉声音IAudioVoice足实l七用许顿IFMOD顿道声音的Jh1.PIaYOneShot运用的是不公显示在播放iKIPIayingSources)的小存 AudioMemoryisthetotalRAMusedbytheaudioengine.舟i内存(AudioMemory)音物引繁所运用的内存电尿.CPUusagecanbeseeninthebottom.MonitorthistoseeifAudioaloneistakinguptoomuchCPU.住啜那可见的CPU运川率,为祭达籽If音嫉是否单独占用太多的CPUPhysicsArea物理学区域PhyssiAct)¼eRtgidbodies一NumberofConu<¼(ThePhysicsareashowsthefollowingstatisticsaboutthephysicsInthescene:-物理学区域显示以卜右关场以物理学的统计,ActiveRigidbodiesisthenumberofrigidbodiesthatarenotcurrentlysleeping(ie,theyaremovingorjustcomingtorest).ActiVeRigidbOdieS是指”前活动的刚体数(也就是说.他们正移动或仅刖刚静止)”SleepingRigidbodiesisthenumberofrigidbodiesthatarecompletelyatrestandthereforedon'tneedtobeupdatedactivelybythephysicsengine(seeRigidbodySleepingforfurtherdetails).SleepingRigidbodies是指你西静止的刚体S因此.不须要物理弓I整上初更新(群情誓见RigidbodySleeping).NumberofContactsisthetotalnumberofpointsofcontactbehveenallcollidersinthescene.NumberofContacts(接触点数)是指场景中的全邮接触点的总数.StaticCollidersisthenumberofcollidersattachedtonon-rigidbodyobjects(iefobjectswhichnevermoveunderphysics).StaticColliders(静寂的M)是指附加到季刚体物体的烟Mlldft(也就理作用下移动)DynamicCollidersisthenumberofcollidersattachedtorigidbodyobjects(ie,objectswhichdomoveunderphysics).DynamicColliders(动态磁撞28)足指附加到刚体物体的Bf描制数让(也就是说,物体可以在物理的作用下移功>ProfilerAddProfilerActiveRigidbodies1SleepingRigidbodies:ONumberofContacts:OStaticColliders.ODynamicColliders:1GPUArea(GPU区域)6ProfilerAddFrofilerjORecordIDeepProfileAcbv<ProfiletQm66ms(1516m$(6OgGPUUsageOtMqoeTra11ipifntOShidowsDeferredRrePaOfrrdlightingRoitroceiSOtb*fbiQ.67E,ToUibQWad1$GPUmSlOWMjToUJa疝市IUinCar100.0%£CameraRender100.0%857.416Drawing75.0%543.062Render.OpaqueCeometr75.0%343.062RenderForwardOpaque.Render75.0%343.062MeshDrawVBO75.0%343.062Clear0.0%10.000CamcraJmageEffeccs0.0%10.000CanieraJmageEffects2S.0%314.354Cmer,lmagcEffects25.0%214354CameraJmageEffect2S.0%114.354SepiaToncEffcctOnRendcrImageO25.0%114354HierarchyOverviewTheGPUprofilerIssimilartotheCPUprofilerwiththevariouscontributionstorenderingtimeshownasahierarchyinthebottompanel.Selectinganitemfromthehierarchywillsowabreakdowninthepaneltotheright.GPU分析器类似于CPU分析据.关卜消染时间的不同奉献,在底茶面板作为层级。示.从信纵选样的工程会黑示左右边的问板细分.PleasenotethatontheMac,GPUprofilingisonlyavailableunderOSX10.7Uonandlaterversions.请防总在Mac.GPU分析然仅在OSX10.71.ion喷更高版本河川.SeeAlso参见OptimizingGraphicsPerformancepage.优化图彩性能页面iOSRemoteprofilingcanbeenabledoniOSdevicesbyfollowingthesesteps:iOS设备上后用远程分析可以通过以卜步爨:IConnectyourIOSdevicetoyourWiFinetwork(local/adhocWiFinehvorkIsusedbyprofilertosendprofilingdatafromdevicetotheUnityEditor).您的iOS设备连接到WIFI网络(分析器运用本地adhocWiFi网络发送分析妆械.从一缶到Unity的摘林霹2 Check'AutownnectProfiler"checkboxinUnity'sbuildsettingsdialog.在Unity的构建立TTtbUHdSettingsl时话框中的,勾上发选框自动连接分析:SAutoconnectProfiler)3 AttachyourdevicetoyourMacviacableandit"Build&Run"InUnityEditor.通过数品统格您的设备连接到你的Mac,花Unity编林器中点击”BwdARun".4 Whenapplaunchesondeviceopenprofilerv/indowinUnityEditor(Window->Profiler)当应用积序在设各上启动,在Unity的呜辑翻开分析戕由UWindOW->Profiler)Ifyouareusingafirewall,youneedtomakesurethatports54998to55511areopeninthefirewall'soutboundrules-thesearetheportsusedbyUnityforremoteprofiling.假如运用了防火堵,你必;浦保用U54998到55511在防火塔的出站规那么被M开,这些.端”都是UEty远程分析要运用的端口.Note:SometimesUnityEditormightnotautoconnecttothedevice.InsuchcasesprofilerconnectionmightbeinitiatedfromProfilerWindowActiveProfilerdropdownmenubyselectappropriatedevice.出有时.在Unity的俄的器可能不会自动连接迷该设招在这种状况下.在分析部窗口的ActiVePrOfMer卜拉泰千顶透撑掷相应的设备,分析81连接,工AndroidRemoteprofilingcanbeenabledonAndroiddevicesthroughtwodifferentpaths:WiFiorADB.近程分析可以在Android设备通过两种不同的途径后用:WiFiiAADB.ForWiFiprofiling,followthesesteps:对IWiFi分析.川以下的这些步骤:5 MakesuretodisableMobileDataonyourAndroiddevice.WffiiKAndriod设在S用手机数据6 ConnedyourAndroiddevicetoyourWiFinetwork.连接Android设备到你的WifiMffk7 Checkthe"AutoconnectProfiler*checkboxinUnity'sbuildsettingsdialog.在Unity编评出双时话框,检代AutoconnectProfiler史选根是古勾迭,8 AttachyourdevicetoyourMac/PCviacableandhitwBild&Run"inUnityEditor.通过数界线连接你的谀餐到电IK在UniIV点击Build&Run.9 Whentheapplaunchesonthedevice,opentheprofilerwindowinUnityEditor(Wldow->Profiler)当应用程序在次数上启动在Unity翻开分析器窗口(Window->Profierj.IOIftheUnityEditorfailstoautoconnecttothedevice,selecttheappropriatedevicefromtheProfilerWindowActiveProfilerdropdownmenu.假如Unity无法自动连接到该&的从分析器腐WAcHvePro印er下拉菜冷,选择相应的役备,Note:TheAndroiddeviceandhostcomputer(runningtheUnityEditor)mustbothbeonthesamesubnetforthedevicedetectiontowork.WjS:AndIoid设番和主机计算机(正运行UNty)必需两挣在同子网才能正常运行设备检测作.ForADBprofiling,followthesesteps:时fADB分析,用以F的这些步骤I AttachyourdevicetoyourMac/PCviacableandmakesureADBrecognizesthedevice(i.e.itsowsinadbdeviceslist).通过数第戏煌接设备到电脑,并确保ADBiQ备设备也就是说它显示在ADB仪备列表) OpenaTerminalwindow/CMDpromptandenter加开个终端窗口/CMD提示符件输入adbforwardtcp:54999localabstract:Unity-<in5©rtbundleidentifierhere> Ceck"DevelopmentBuild-checkboxinUnity'sbuildsettingsdialog,andhit,Build&Run".在Unity编洋巾"对话机出代DevelopmentBuild要板是否勾i并点缶Build&Run Whentheapplaunchesonthedevice,opentheprofilerwindowInUEtVEditor(Window->Profiler)当应用程序在设各上启动.在UnityIB开分析器窗【IWindow->Profiler), SelecttheAndroidProfiler(:54999)fromtheProfilerWindowActiveProfilerdropdownmenu.从分析器的IActiveProfiler门*菜单项选杼扑AndedPrOfW”:£4999)Note:TheentryinthedropdownmenuisonlyvisiblewhentheselectedtargetisAndroid.留却进入下拉菜单中选择H标是Android曜可见时选拉.Ifyouareusngafirewall,youneedtomakesurethatports54998to55511areopeninthefirewll,soutboundrules-thesearetheportsusedbyUnityforremoteprofiling.假如运Mr防火塔.你必常确保册门54998列55511在防火塔的出站现邠么般翻开这些却1都是Unlty远程分析要运川的端口.