public static void Combine (GameObject staticBatchRoot);

Parameters

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

Description

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);

Parameters

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

Description

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.