StaticBatchingUtility

class in UnityEngine

Switch to Manual

Description

StaticBatchingUtility 可使对象准备好利用 Unity 的静态批处理。

此步骤可用作性能优化,从而使引擎能够显著减少绘制调用的次数, 但使渲染几何体的数量保持不变。

By calling one of the Combine methods you will create an internal mesh which will contain combined geometry, however each original GameObject will be present in the Scene and will be culled individually. The fact that GameObjects can be culled individually allows run-time to render the same amount of geometry as it would without batching, unlike combining geometry in the modeling tool. Combining geometry in the modeling tool prevents efficient culling and results in much higher amount of geometry being rendered.

注意,已在 Editor 中标记为“Static”的对象无需调用 Combine 方法。在 Build Player 步骤中, 它们将自动为静态批处理做好准备。

重要信息:只能对具有相同材质的对象进行批处理,因此尽可能多地共享纹理/材质非常有用。

Static Functions

Combine StaticBatchingUtility.Combine prepares all children of the staticBatchRoot for static batching.