UnityProfiler概述

      網(wǎng)友投稿 1301 2022-05-29

      Profiler overview

      Unity 官方說明文檔及翻譯:

      The Unity Profiler Window 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 Profiler窗口可以幫助你優(yōu)化你的游戲。它會為你報告你在游戲的各個領(lǐng)域花費了多少時間。例如,它可以報告花費在呈現(xiàn)上的時間百分比

      ,動畫或在你的游戲邏輯。

      You can analyze the performance of the GPU, CPU, memory, rendering, and audio.

      您可以分析GPU、CPU、內(nèi)存、呈現(xiàn)和音頻的性能。

      To see the profiling data, you play your game in the Editor with Profiling on, and it records 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.

      Note that profiling has to instrument your code (that is; add some instructions to facilitate the check). While this has a small impact on the performance of your game, the overhead is small enough to not affect the game framerate.

      要查看性能分析數(shù)據(jù),您可以在帶有性能分析的編輯器中玩游戲,它會記錄性能數(shù)據(jù)。然后,分析器窗口在時間軸中顯示數(shù)據(jù)

      因此,你可以看到幀或區(qū)域的峰值(需要更多的時間)比其他。通過單擊時間軸中的任何地方,Profiler窗口的底部部分將顯示所選框架的詳細(xì)信息。

      注意,分析必須測試您的代碼(即;增加一些說明以方便檢查)。雖然這對游戲的性能影響很小,但開銷卻小到足以不影響游戲的幀率。

      Tips on using the Tool

      When using the profiling tool, 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; there may be unexpected consequences of your code optimization.

      See Profiler window documentation for details of the Profiler window.

      See also: Optimizing Graphics Performance.

      使用該工具的提示

      在使用分析工具時,將注意力集中在游戲中消耗時間最多的部分。比較代碼更改前后的分析結(jié)果,并確定度量的改進(jìn)。有時您為提高性能所做的更改可能會對幀速率產(chǎn)生負(fù)面影響;您的代碼優(yōu)化可能會產(chǎn)生意想不到的結(jié)果。

      有關(guān)Profiler窗口的詳細(xì)信息,請參閱Profiler窗口文檔。

      參見:優(yōu)化圖形性能。

      Profiler窗口

      通過工具欄訪問Unity編輯器中的Profiler窗口:Window > Profiler。(默認(rèn)快捷鍵Ctrl+7)

      長這個樣子:

      Profiler控件位于窗口頂部的工具欄中。使用這些來打開和關(guān)閉仿形,并通過異形框架導(dǎo)航。傳輸控件位于工具欄的最右端。注意,當(dāng)游戲運行時,探查器正在收集數(shù)據(jù),點擊其中的任何一個傳輸控件暫停游戲。

      Optimizing graphics performance 優(yōu)化圖形性能

      Good performance is critical to the success of many games. Below are some simple guidelines for maximizing the speed of your game’s rendering.

      優(yōu)化圖形性能,良好的性能是許多游戲成功的關(guān)鍵。以下是一些簡單的指導(dǎo)方針,以最大限度地提高你的游戲的渲染速度。

      Locate high graphics impact

      The graphical parts of your game can primarily impact on two systems of the computer: the GPU and the CPU. The first rule of any optimization is to find where the performance problem is, because strategies for optimizing for GPU vs. CPU are quite different (and can even be opposite - for example, it’s quite common to make the GPU do more work while optimizing for CPU, and vice versa).

      定位高圖形影響

      游戲的圖形部分主要影響計算機的兩個系統(tǒng):GPU和CPU。任何優(yōu)化的首要規(guī)則都是找出性能問題所在,因為GPU和CPU的優(yōu)化策略是完全不同的(甚至可能是相反的——例如,在優(yōu)化CPU時讓GPU做更多的工作是很常見的,反之亦然)。

      Common bottlenecks and ways to check for them:

      常見瓶頸及其檢查方法:

      GPU is often limited by fillrate or memory bandwidth.

      Lower the display resolution and run the game. If a lower display resolution makes the game run faster, you may be limited by fillrate on the GPU.

      CPU is often limited by the number of batches that need to be rendered.

      Check “batches” in the Rendering Statistics window. The more batches are being rendered, the higher the cost to the CPU.

      Less-common bottlenecks:

      GPU常常受到填充率或內(nèi)存帶寬的限制。降低顯示分辨率并運行游戲。如果較低的顯示分辨率使游戲運行得更快,您可能會受到GPU上填充率的限制。CPU常常受到需要呈現(xiàn)的批處理數(shù)量的限制。檢查呈現(xiàn)統(tǒng)計窗口中的“批”。批處理越多,CPU的成本就越高。較少-共同的瓶頸:

      The GPU has too many vertices to process. The number of vertices that is acceptable to ensure good performance depends on the GPU and the complexity of vertex shaders. Generally speaking, aim for no more than 100,000 vertices on mobile. A PC manages well even with several million vertices, but it is still good practice to keep this number as low as possible through optimization.

      The CPU has too many vertices to process. This could be in skinned meshes, cloth simulation, particles, or other game objects and meshes. As above, it is generally good practice to keep this number as low as possible without compromising game quality. See the section on CPU optimization below for guidance on how to do this.

      If rendering is not a problem on the GPU or the CPU, there may be an issue elsewhere - for example, in your script or physics. Use the Unity Profiler to locate the problem.

      GPU有太多的頂點不能處理。能夠保證良好性能的頂點數(shù)目取決于GPU和頂點著色器的復(fù)雜性。一般來說,目標(biāo)在移動平臺上的頂點不超過10萬個。即使有幾百萬個頂點,PC仍能很好地管理,但通過優(yōu)化盡可能保持這個數(shù)目的低仍然是很好的做法。CPU有太多的頂點不能處理。這可以是在蒙皮網(wǎng)格,布模擬,粒子,或其他游戲?qū)ο蠛途W(wǎng)格。如前所述,在不影響游戲質(zhì)量的情況下,保持這個數(shù)字盡可能低通常是很好的做法。有關(guān)如何進(jìn)行此操作的指導(dǎo),請參閱下面關(guān)于CPU優(yōu)化的部分。如果渲染不是GPU或CPU上的問題,那么在其他地方可能會有問題-例如,在您的腳本或物理中。使用UnityProfiler查找問題。

      CPU optimization

      To render objects on the screen, the CPU has a lot of processing work to do: working out which lights affect that object, setting up the shader and shader parameters, and sending drawing commands to the graphics driver, which then prepares the commands to be sent off to the graphics card.

      CPU優(yōu)化以在屏幕上呈現(xiàn)對象,CPU有大量的處理工作要做:確定影響該對象的燈光,設(shè)置著色器和著色器參數(shù),并向圖形驅(qū)動程序發(fā)送繪圖命令,然后該驅(qū)動程序準(zhǔn)備發(fā)送到圖形卡的命令。

      All this “per object” CPU usage is resource-intensive, so if you have lots of visible objects, it can add up. For example, if you have a thousand triangles, it is much easier on the CPU if they are all in one mesh, rather than in one mesh per triangle (adding up to 1000 meshes). The cost of both scenarios on the GPU is very similar, but the work done by the CPU to render a thousand objects (instead of one) is significantly higher.

      所有這些“每個對象”的CPU使用都是資源密集型的,所以如果您有很多可見對象,就可以將它們加起來。例如,如果您有1000個三角形,那么如果它們都在一個網(wǎng)格中,而不是每個三角形在一個網(wǎng)格中(總共1000個網(wǎng)格),那么在CPU上就容易得多。在GPU上,這兩種場景的成本非常相似,但是CPU渲染1000個對象(而不是一個)所做的工作要高得多。

      Reduce the visible object count. To reduce the amount of work the CPU needs to do:

      減少可見對象數(shù)。為了減少cpu需要做的工作量

      Combine close objects together, either manually or using Unity’s draw call batching.

      Use fewer materials in your objects by putting separate textures into a larger texture atlas.

      Use fewer things that cause objects to be rendered multiple times (such as reflections, shadows and per-pixel lights).

      Combine objects together so that each mesh has at least several hundred triangles and uses only one Material for the entire mesh. Note that combining two objects which don’t share a material does not give you any performance increase at all. The most common reason for requiring multiple materials is that two meshes don’t share the same textures; to optimize CPU performance, ensure that any objects you combine share the same textures.

      將關(guān)閉對象組合在一起,或者手動地或者使用聯(lián)合的繪圖調(diào)用批處理。在你的對象中使用更少的材料,把不同的紋理放到一個更大的紋理圖譜中。使用較少的東西,使對象被呈現(xiàn)多次(如反射,陰影和每像素?zé)?。將物體組合在一起,使每個網(wǎng)格至少有幾百個三角形,并且整個網(wǎng)格只使用一種材料。請注意,將兩個不共享材料的對象組合在一起并不能提高性能。需要多個材料的最常見的原因是兩個網(wǎng)格不共享相同的紋理;要優(yōu)化CPU性能,確保組合的任何對象共享相同的紋理。

      When using many pixel lights in the Forward rendering path, there are situations where combining objects may not make sense. See the Lighting performance section below to learn how to manage this.

      在前向渲染路徑中使用多個像素?zé)魰r,在某些情況下組合對象可能沒有意義。請參閱下面的“照明性能”部分,以了解如何管理該功能。

      GPU: Optimizing model geometry

      There are two basic rules for optimizing the geometry of a model:

      GPU:優(yōu)化模型幾何有兩個基本規(guī)則來優(yōu)化模型的幾何形狀:

      Don’t use any more triangles than necessary

      Try to keep the number of UV mapping seams and hard edges (doubled-up vertices) as low as possible

      Note that the actual number of vertices that graphics hardware has to process is usually not the same as the number reported by a 3D application. Modeling applications usually display the number of distinct corner points that make up a model (known as the geometric vertex count). For a graphics card, however, some geometric vertices need to be split into two or more logical vertices for rendering purposes. A vertex must be split if it has multiple normals, UV coordinates or vertex colors. Consequently, the vertex count in Unity is usually higher than the count given by the 3D application.

      不要使用任何必要的三角形,盡量保持UV映射接縫和硬邊的數(shù)量(加倍頂點),注意圖形硬件必須處理的實際頂點數(shù)通常與3D應(yīng)用程序報告的數(shù)目不同。建模應(yīng)用程序通常顯示構(gòu)成模型的不同角點的數(shù)量(稱為幾何頂點計數(shù))。然而,對于顯卡來說,為了渲染的目的,需要將一些幾何頂點分割成兩個或多個邏輯頂點。如果頂點具有多個法線、UV坐標(biāo)或頂點顏色,則必須將其拆分。因此,統(tǒng)一中的頂點計數(shù)通常高于3D應(yīng)用程序所給出的計數(shù)。

      While the amount of geometry in the models is mostly relevant for the GPU, some features in Unity also process models on the CPU (for example, mesh skinning).

      雖然模型中的幾何量主要與GPU有關(guān),但有些Unity中的特性也在CPU上處理模型(例如,網(wǎng)格蒙皮)。

      Lighting performance

      The fastest option is always to create lighting that doesn’t need to be computed at all. To do this, use Lightmapping to “bake” static lighting just once, instead of computing it each frame. The process of generating a lightmapped environment takes only a little longer than just placing a light in the scene in Unity, but:

      照明性能最快的選擇總是創(chuàng)建照明,根本不需要計算。要做到這一點,使用Lightmap來“烘焙”靜態(tài)照明一次,而不是計算每個幀。生成光映射環(huán)境的過程只需稍長一點,而不只是在“Unitity”中的場景中放置一盞燈,但是:

      It runs a lot faster (2–3 times faster for 2-per-pixel lights)

      It looks a lot better, as you can bake global illumination and the lightmapper can smooth the results

      In many cases you can apply simple tricks instead of adding multiple extra lights. For example, instead of adding a light that shines straight into the camera to give a Rim Lighting effect, add a dedicated Rim Lighting computation directly into your shaders (see Surface Shader Examples to learn how to do this).

      它運行得更快(2像素?zé)舻倪\行速度是2到3倍),它看起來好多了,因為你可以烘焙全局照明,而且在很多情況下,光映射器可以平滑結(jié)果,你可以應(yīng)用簡單的技巧而不是添加多個額外的燈光。例如,不要添加直接射入相機的光線以獲得邊緣照明效果,而是將專用的邊緣照明計算直接添加到著色器中(請參閱表面著色示例以了解如何做到這一點)。

      Lights in forward rendering

      Also see: Forward rendering

      前向渲染中的燈也見:正演渲染。

      Per-pixel dynamic lighting adds significant rendering work to every affected pixel, and can lead to objects being rendered in multiple passes. Avoid having more than one Pixel Light illuminating any single object on less powerful devices, like mobile or low-end PC GPUs, and use lightmaps to light static objects instead of calculating their lighting every frame. Per-vertex dynamic lighting can add significant work to vertex transformations, so try to avoid situations where multiple lights illuminate a single object.

      每個像素的動態(tài)照明為每個受影響的像素增加了重要的渲染工作,并可能導(dǎo)致對象在多次傳遞中呈現(xiàn)。避免在不太強大的設(shè)備(如移動或低端PC GPU)上照明任何單一物體,并使用光圖來照明靜態(tài)物體,而不是計算它們的每一幀照明。每個頂點的動態(tài)照明可以為頂點轉(zhuǎn)換增加重要的工作,因此盡量避免多個燈照亮單個對象的情況。

      Avoid combining meshes that are far enough apart to be affected by different sets of pixel lights. When you use pixel lighting, each mesh has to be rendered as many times as there are pixel lights illuminating it. If you combine two meshes that are very far apart, it increase the effective size of the combined object. All pixel lights that illuminate any part of this combined object are taken into account during rendering, so the number of rendering passes that need to be made could be increased. Generally, the number of passes that must be made to render the combined object is the sum of the number of passes for each of the separate objects, so nothing is gained by combining meshes.

      避免合并的網(wǎng)格是足夠遠(yuǎn)的距離,以影響不同的集合像素?zé)簟.?dāng)你使用像素照明,每個網(wǎng)格必須渲染的次數(shù),因為有像素?zé)粽樟了H绻麑蓚€非常相距很遠(yuǎn)的網(wǎng)格組合在一起,則會增加組合對象的有效大小。在渲染過程中,所有照亮這個組合對象的任何部分的像素?zé)舳紩豢紤]在內(nèi),因此需要進(jìn)行渲染的通道的數(shù)量可以增加。通常,呈現(xiàn)合并對象時必須進(jìn)行的傳遞數(shù)是每個單獨對象的傳遞次數(shù)之和,因此合并網(wǎng)格不會獲得任何結(jié)果。

      During rendering, Unity finds all lights surrounding a mesh and calculates which of those lights affect it most. The Quality Settings are used to modify how many of the lights end up as pixel lights, and how many as vertex lights. Each light calculates its importance based on how far away it is from the mesh and how intense its illumination is - and some lights are more important than others purely from the game context. For this reason, every light has a Render Mode setting which can be set to Important or Not Important; lights marked as Not Important have a lower rendering overhead.

      在渲染過程中,統(tǒng)一會發(fā)現(xiàn)網(wǎng)格周圍的所有燈光,并計算出哪些光線對其影響最大。“質(zhì)量設(shè)置”用于修改最終作為像素?zé)舻臒魯?shù)和作為頂點燈的燈數(shù)。每一盞燈的重要性都是根據(jù)它離網(wǎng)狀網(wǎng)有多遠(yuǎn),以及它的照明強度來計算的-有些燈光比其他光更重要,這完全取決于游戲背景。因此,每個燈都有一個渲染模式設(shè)置,可以設(shè)置為重要或不重要;標(biāo)記為不重要的燈具有較低的渲染開銷。

      Example: Consider a driving game in which the player’s car is driving in the dark with headlights switched on. The headlights are probably the most visually significant light source in the game, so their Render Mode should be set to Important. There may be other lights in the game that are less important, like other cars’ rear lights or distant lampposts, and which don’t improve the visual effect much by being pixel lights. The Render Mode for such lights can safely be set to Not Important to avoid wasting rendering capacity in places where it has little benefit.

      舉個例子:在一個駕駛游戲中,玩家的車開著前燈在黑暗中行駛。前燈可能是最有視覺意義的光源在游戲中,所以他們的渲染模式應(yīng)該設(shè)置為重要。游戲中可能會有一些不太重要的燈光,比如其他汽車的后燈或遠(yuǎn)距離的燈柱,而這些燈光并不能通過像素?zé)魜砀纳埔曈X效果。這種燈的渲染模式可以安全地設(shè)置為不重要,以避免浪費渲染能力的地方,它沒有什么好處。

      Optimizing per-pixel lighting saves both the CPU and GPU work: the CPU has fewer draw calls to do, and the GPU has fewer vertices to process and pixels to rasterize for all the additional object renders.

      優(yōu)化每像素照明節(jié)省了CPU和GPU的工作:CPU有較少的繪制調(diào)用要做,而GPU有更少的頂點需要處理,像素為所有額外的對象渲染的柵格化。

      GPU: Texture compression and mipmaps

      Use Compressed textures to decrease the size of your textures. This can result in faster load times, a smaller memory footprint, and dramatically increased rendering performance. Compressed textures only use a fraction of the memory bandwidth needed for uncompressed 32-bit RGBA textures.

      GPU:紋理壓縮和mipmap

      使用壓縮紋理來減少紋理的大小。這可以導(dǎo)致更快的加載時間、更小的內(nèi)存占用和顯著提高呈現(xiàn)性能。壓縮紋理僅使用未壓縮32位RGBA紋理所需內(nèi)存帶寬的一小部分。

      Texture mipmaps

      Always enable Generate mipmaps for textures used in a 3D scene. A mipmap texture enables the GPU to use a lower resolution texture for smaller triangles.This is similar to how texture compression can help limit the amount of texture data transfered when the GPU is rendering.

      The only exception to this rule is when a texel (texture pixel) is known to map 1:1 to the rendered screen pixel, as with UI elements or in a 2D game.

      紋理mipmap總是能夠為3D場景中使用的紋理生成mipmap。mipmap紋理使GPU能夠?qū)^小的三角形使用較低分辨率的紋理,這類似于紋理壓縮可以幫助限制GPU渲染時傳輸?shù)募y理數(shù)據(jù)量。這個規(guī)則的唯一例外是,當(dāng)一個紋理像素(紋理像素)已知映射1:1到呈現(xiàn)的屏幕像素時,就像UI元素或2D游戲中的那樣。

      LOD and per-layer cull distances

      Culling objects involves making objects invisible. This is an effective way to reduce both the CPU and GPU load.

      LOD和每層精選距離

      剔除對象包括使對象不可見。這是降低CPU和GPU負(fù)載的有效方法

      In many games, a quick and effective way to do this without compromising the player experience is to cull small objects more aggressively than large ones. For example, small rocks and debris could be made invisible at long distances, while large buildings would still be visible.

      In many games, a quick and effective way to do this without compromising the player experience is to cull small objects more aggressively than large ones. For example, small rocks and debris could be made invisible at long distances, while large buildings would still be visible.

      There are a number of ways you can achieve this:

      Use the Level Of Detail system

      Manually set per-layer culling distances on the camera

      Put small objects into a separate layer and set up per-layer cull distances using the Camera.layerCullDistances script function

      您可以通過多種方法實現(xiàn)這一點:使用詳細(xì)級別系統(tǒng)手動設(shè)置攝像機上的每一層剔除距離,將小對象放置在單獨的一層中,并使用Camera.layerCullfar腳本函數(shù)設(shè)置每一層的裁剪距離。

      Realtime shadows

      Realtime shadows are nice, but they can have a high impact on performance, both in terms of extra draw calls for the CPU and extra processing on the GPU. For further details, see the Light Performance page.

      實時陰影是不錯的,但它們會對性能產(chǎn)生很大的影響,無論是對CPU的額外繪圖調(diào)用,還是GPU上的額外處理。有關(guān)詳細(xì)信息,請參閱輕型性能頁面。

      GPU: Tips for writing high-performance shaders

      Different platforms have vastly different performance capabilities; a high-end PC GPU can handle much more in terms of graphics and shaders than a low-end mobile GPU. The same is true even on a single platform; a fast GPU is dozens of times faster than a slow integrated GPU.

      GPU:不同平臺編寫高性能著色器的技巧有很大不同的性能;高端PC GPU比低端移動GPU能處理更多的圖形和著色器。即使在一個平臺上也是如此;一個快速GPU比一個慢集成GPU快幾十倍。

      GPU performance on mobile platforms and low-end PCs is likely to be much lower than on your development machine. It’s recommended that you manually optimize your shaders to reduce calculations and texture reads, in order to get good performance across low-end GPU machines. For example, some built-in Unity shaders have “mobile” equivalents that are much faster, but have some limitations or approximations.

      GPU在移動平臺和低端PC上的性能可能要比在您的開發(fā)機器上低得多。建議您手動優(yōu)化您的著色器,以減少計算和紋理讀取,以獲得良好的性能在低端GPU機器。例如,一些內(nèi)置的United著色器具有“移動”等價物,其速度要快得多,但也有一些限制或近似

      Below are some guidelines for mobile and low-end PC graphics cards:

      以下是移動和低端PC顯卡的一些指南:

      Complex mathematical operations

      Transcendental mathematical functions (such as pow, exp, log, cos, sin, tan) are quite resource-intensive, so avoid using them where possible. Consider using lookup textures as an alternative to complex math calculations if applicable.

      Avoid writing your own operations (such as normalize, dot, inversesqrt). Unity’s built-in options ensure that the driver can generate much better code. Remember that the Alpha Test (discard) operation often makes your fragment shader slower.

      Floating point precision

      While the precision (float vs half vs fixed) of floating point variables is largely ignored on desktop GPUs, it is quite important to get a good performance on mobile GPUs. See the Shader Data Types and Precision page for details.

      For further details about shader performance, see the Shader Performance page.

      復(fù)雜的數(shù)學(xué)運算-超越數(shù)學(xué)函數(shù)(如pow、exp、log、cos、sin、tan)-資源密集,因此盡可能避免使用它們。如果適用的話,可以考慮使用查找紋理作為復(fù)雜數(shù)學(xué)計算的替代方法。避免編寫自己的操作(如規(guī)范化、點、逆)。統(tǒng)一的內(nèi)置選項確保驅(qū)動程序能夠生成更好的代碼。記住,Alpha測試(丟棄)操作經(jīng)常會使片段著色器變慢。在桌面GPU中,浮點變量的精度(浮點對半變量和固定變量)在很大程度上被忽略,因此在移動GPU上獲得良好的性能是非常重要的。有關(guān)詳細(xì)信息,請參閱Shader數(shù)據(jù)類型和精度頁面。有關(guān)著色器性能的詳細(xì)信息,請參閱“著色性能”頁面。

      Simple checklist to make your game faster

      Keep the vertex count below 200K and 3M per frame when building for PC (depending on the target GPU).

      If you’re using built-in shaders, pick ones from the Mobile or Unlit categories. They work on non-mobile platforms as well, but are simplified and approximated versions of the more complex shaders.

      Keep the number of different materials per scene low, and share as many materials between different objects as possible.

      簡單的清單,使您的游戲更快,保持頂點計數(shù)低于200 K和3M每幀建設(shè)時,為個人電腦(取決于目標(biāo)GPU)。如果您使用內(nèi)置著色器,從移動或未亮的類別中選擇一個。它們也在非移動平臺上工作,但它們是更復(fù)雜的著色器的簡化和近似版本。保持每個場景的不同材料的數(shù)量低,并在不同的對象之間共享盡可能多的材料。

      Set the Static property on a non-moving object to allow internal optimizations like static batching.

      Only have a single (preferably directional) pixel light affecting your geometry, rather than multiples.

      Bake lighting rather than using dynamic lighting.

      Use compressed texture formats when possible, and use 16-bit textures over 32-bit textures.

      Avoid using fog where possible.

      Use Occlusion Culling to reduce the amount of visible geometry and draw-calls in cases of complex static scenes with lots of occlusion. Design your levels with occlusion culling in mind.

      Use skyboxes to “fake” distant geometry.

      Use pixel shaders or texture combiners to mix several textures instead of a multi-pass approach.

      Use half precision variables where possible.

      Minimize use of complex mathematical operations such as pow, sin and cos in pixel shaders.

      Use fewer textures per fragment.

      在非移動對象上設(shè)置靜態(tài)屬性,以允許內(nèi)部優(yōu)化,如靜態(tài)批處理。只有一個(最好是定向的)像素光影響你的幾何學(xué),而不是倍數(shù)。烘焙照明,而不是使用動態(tài)照明。在可能的情況下使用壓縮的紋理格式,并在32位紋理上使用16位紋理.盡量避免使用霧。使用遮擋剔除來減少可視幾何的數(shù)量,并在復(fù)雜的靜態(tài)場景和大量遮擋的情況下繪制調(diào)用。設(shè)計你的水平與遮擋剔除在腦海中。使用天窗來“偽造”遙遠(yuǎn)的幾何圖形。使用像素著色器或紋理組合器混合多個紋理,而不是多通道方法。盡可能使用一半精度的變量。盡量減少復(fù)雜的數(shù)學(xué)操作,如POW,SIN和cos在像素著色器中的使用。每個片段使用較少的紋理。

      以上是Unity 官方給出的優(yōu)化圖形性能的文檔

      Unity 之 Profiler概述

      當(dāng)打開Deep Profile時,所有的腳本代碼都被定義了—也就是說,所有函數(shù)調(diào)用都被記錄下來。這是有用的知道確切的時間花費在你的游戲代碼。

      PS:深度剖析會產(chǎn)生非常大的開銷,占用大量內(nèi)存,因此,在進(jìn)行分析時,游戲運行速度會大大減慢。如果代碼過于復(fù)雜,可能根本無法進(jìn)行深度剖析。對于基本代碼游戲,深度剖析應(yīng)該足夠快。如果發(fā)現(xiàn)對整個游戲的深度剖析會導(dǎo)致幀速率下降,以至于游戲幾乎不能運行,那么就應(yīng)該考慮不使用此方法。當(dāng)游戲過大(大型游戲),深度剖析可能會導(dǎo)致Unity耗盡內(nèi)存,所以,這種深度剖析的方式也是不可能的,這時我們就要使用其他方式、如:手動分析腳本代碼塊的開銷比使用深度分析的開銷小。使用Profiler.BeginSample和Profiler.EndSample腳本函數(shù)來啟用和禁用代碼段的分析

      GPU加速云服務(wù)器 unity

      版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實的內(nèi)容,請聯(lián)系我們jiasou666@gmail.com 處理,核實后本網(wǎng)站將在24小時內(nèi)刪除侵權(quán)內(nèi)容。

      上一篇:轉(zhuǎn)發(fā)與重定向有什么區(qū)別
      下一篇:[跟著官方文檔學(xué)TestNG][一][學(xué)習(xí)筆記]
      相關(guān)文章
      亚洲五月综合缴情婷婷| 久久久久亚洲精品日久生情| 亚洲欧洲日韩综合| 亚洲av无码片在线播放| 久久久久亚洲AV无码专区网站 | 无码专区一va亚洲v专区在线 | 久久精品国产亚洲精品| 亚洲精品老司机在线观看| 一本久久综合亚洲鲁鲁五月天| 午夜亚洲WWW湿好爽| 亚洲A∨精品一区二区三区下载 | 亚洲韩国精品无码一区二区三区| 亚洲一区二区三区免费| 亚洲人成无码www久久久| 亚洲精品第一国产综合精品99| 亚洲一区视频在线播放 | 精品国产人成亚洲区| 国产亚洲自拍一区| 久久亚洲国产午夜精品理论片| 亚洲韩国精品无码一区二区三区 | 亚洲高清国产拍精品26U| 亚洲AV日韩AV天堂一区二区三区| 亚洲人成亚洲精品| 亚洲日韩在线视频| 亚洲精品456人成在线| 亚洲一久久久久久久久| 在线观看亚洲电影| 丁香五月亚洲综合深深爱| 亚洲精品无码不卡在线播HE| 亚洲av无码潮喷在线观看| 久久久亚洲欧洲日产国码aⅴ| 亚洲欧洲精品在线| 色天使亚洲综合在线观看| 亚洲国产精品无码久久98| 日韩精品电影一区亚洲| 日韩精品亚洲aⅴ在线影院| 亚洲av女电影网| 亚洲人成在久久综合网站| 亚洲精品无码中文久久字幕| 亚洲国产综合久久天堂| 亚洲国产成人片在线观看|