Combine
Combines all children GameObjects of the staticBatchRoot for static batching.
Read time 2 minutesLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
Combine(GameObject)
Combines all children GameObjects of the for static batching.
staticBatchRootpublic static void Combine(GameObject staticBatchRoot)
Parameters
The GameObject that should become the root of the combined batch.
Remarks
Static batching is a draw call batching method that combines meshes that don't move to reduce draw calls. For more information about static batching, see Static batching.
This method copies the mesh data of the GameObjects into a single internal mesh. Each original GameObject is still present in the Scene which means Unity can still cull them individually.
All child GameObjects under the must be eligible for static batching. For information on the eligibility requirements for static batching, see Static batching at runtime.
staticBatchRootAfter you combine the GameObjects, you can't change the Transform properties of the children. However, you can change the Transform properties of the . Doing so transforms the entire combined batch.
staticBatchRootNote: You don't need to use this method with GameObjects you marked as Batching Static in the Editor. Unity prepares these GameObjects for static batching when it builds the Player.
See also: Mesh.CombineMeshes, Mesh.isReadable.
Combine(GameObject[], GameObject)
Combines all GameObjects in for static batching and treats as the root.
gosstaticBatchRootpublic static void Combine(GameObject[] gos, GameObject staticBatchRoot)
Parameters
The GameObjects to prepare for static batching.
The GameObject that should become the root of the combined batch.
Remarks
Static batching is a draw call batching method that combines meshes that don't move to reduce draw calls. For more information about static batching, see Static batching.
This method copies the mesh data of the GameObjects into a single internal mesh. Each original GameObject is still present in the Scene which means Unity can still cull them individually.
All GameObjects in must be eligible for static batching. For information on what a GameObject needs to be eligible for static batching, see Static batching at runtime.
gosAfter you combine the GameObjects, you can't change the Transform properties of the children. However, you can change the Transform properties of the . Doing so transforms the entire combined batch.
staticBatchRootNote: You don't need to use this API on GameObjects you marked as Batching Static in the Editor. Unity prepares these GameObjects for static batching when it builds the Player.
See also: Mesh.CombineMeshes, Mesh.isReadable.