Version: 2023.2

Graphics.DrawMeshInstancedProcedural

切换到手册
public static void DrawMeshInstancedProcedural (Mesh mesh, int submeshIndex, Material material, Bounds bounds, int count, MaterialPropertyBlock properties, Rendering.ShadowCastingMode castShadows, bool receiveShadows, int layer, Camera camera, Rendering.LightProbeUsage lightProbeUsage, LightProbeProxyVolume lightProbeProxyVolume);

参数

mesh 要绘制的 Mesh
submeshIndex 要绘制网格的哪个子集。这只适用于由若干种材质构成的网格。
material 要使用的 Material
bounds 围绕要绘制的实例的包围体。
count 要绘制的实例数。
properties 要应用的其他材质属性。请参阅 MaterialPropertyBlock
castShadows Determines whether the Meshes should cast shadows.
receiveShadows Determines whether the Meshes should receive shadows.
layer 要使用的 Layer
camera If null (default), the mesh will be drawn in all cameras. Otherwise it will be drawn in the given Camera only.
lightProbeUsage 实例的 LightProbeUsage

描述

This function is now obsolete. Use Graphics.RenderMeshPrimitives instead. Draws the same mesh multiple times using GPU instancing. This is similar to Graphics.DrawMeshInstancedIndirect, except that when the instance count is known from script, it can be supplied directly using this method, rather than via a ComputeBuffer.

To render the instances with light probes, provide the light probe data via the MaterialPropertyBlock and specify lightProbeUsage with LightProbeUsage.CustomProvided. Check LightProbes.CalculateInterpolatedLightAndOcclusionProbes for the details. Additional resources: Graphics.RenderMeshPrimitives.