public static void Combine (GameObject staticBatchRoot);

Parámetros

staticBatchRootThe GameObject that should become the root of the combined batch.

Descripción

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

A GameObject is only eligible for static batching using this method when all of the following criteria are met:

- The GameObject is active.
- The GameObject has a Mesh Filter component, and that component is enabled.
- The Mesh Filter component has a reference to a Mesh.
- The Mesh is read/write enabled.
- The Mesh has a vertex count greater than 0.
- The Mesh has not already been combined with another Mesh.
- The GameObject has a Mesh Renderer component, and that component is enabled.
- The Mesh Renderer component does not use any Material with a shader that has the DisableBatching tag set to true.


When you use this method, you do not need to mark a GameObject as Batching Static using the Inspector window’s Static check box to make it eligible for batching.

Once combined, children cannot change their Transform properties; however, you can change the transform properties of staticBatchRoot.

See also: Mesh.CombineMeshes, Mesh.isReadable.


public static void Combine (GameObject[] gos, GameObject staticBatchRoot);

Parámetros

gosThe GameObjects to prepare for static batching.
staticBatchRootThe GameObject that should become the root of the combined batch.

Descripción

StaticBatchingUtility.Combine prepares all GameObjects contained in gos for static batching. staticBatchRoot is treated as their parent.

StaticBatchingUtility.Combine prepares all GameObjects contained in gos for static batching. staticBatchRoot is treated as their parent.

A GameObject is eligible for static batching using this method only when all of the following criteria are met:
- The GameObject is active.
- The GameObject has a Mesh Filter component, and that component is enabled.
- The Mesh Filter component has a reference to a Mesh.
- The Mesh is read/write enabled.
- The Mesh has a vertex count greater than 0.
- The Mesh has not already been combined with another mesh.
- The GameObject has a Mesh Renderer component, and that component is enabled.
- The Mesh Renderer does not use any Material with a shader that has the DisableBatching tag set to true.


When you use this method, you do not need to mark a GameObject as Batching Static using the Inspector window’s Static check box to make it eligible for batching.

Once combined, GameObjects contained in gos cannot change their Transform properties; however, you can move staticBatchRoot.

See also: Mesh.CombineMeshes, Mesh.isReadable.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961