Version: 2023.1
LanguageEnglish
  • C#

StaticBatchingUtility.Combine

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void Combine(GameObject staticBatchRoot);

Parameters

staticBatchRoot The GameObject that should become the root of the combined batch.

Description

Combines all children GameObjects of the staticBatchRoot for static batching.

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 staticBatchRoot must be eligible for static batching. For information on the eligibility requirements for static batching, see Static batching at runtime.

After you combine the GameObjects, you can't change the Transform properties of the children. However, you can change the Transform properties of the staticBatchRoot. Doing so transforms the entire combined batch.

Note: 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.


Declaration

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

Parameters

gos The GameObjects to prepare for static batching.
staticBatchRoot The GameObject that should become the root of the combined batch.

Description

SCombines all GameObjects in gos for static batching and treats staticBatchRoot as the root.

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 gos must be eligible for static batching. For information on what a GameObject needs to be eligible for static batching, see Static batching at runtime.

After you combine the GameObjects, you can't change the Transform properties of the children. However, you can change the Transform properties of the staticBatchRoot. Doing so transforms the entire combined batch.

Note: 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.

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