Version: 2020.3

描述

将 GameObject 的网格与其他符合条件的网格组合起来,有可能降低运行时渲染成本。

有关更多信息,请参阅有关静态批处理的文档。

请注意,可以使用 StaticBatchingUtility.Combine 组合运行时未启用此 StaticEditorFlag 的网格。

using UnityEngine;
using UnityEditor;
public class StaticEditorFlagsExample
{
    [MenuItem("Examples/Create GameObject and set Static Editor Flags")]
    static void CreateGameObjectAndSetStaticEditorFlags()
    {
        // Create a GameObject
        var go = new GameObject("Example");
        // Set the GameObject's StaticEditorFlags
        var flags = StaticEditorFlags.BatchingStatic;
        GameObjectUtility.SetStaticEditorFlags(go, flags);
    }
}