DrawMeshInstancedProcedural(Mesh, int, Material, Bounds, int, MaterialPropertyBlock, ShadowCastingMode, bool, int, Camera, LightProbeUsage, LightProbeProxyVolume)
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.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static void DrawMeshInstancedProcedural(Mesh mesh, int submeshIndex, Material material, Bounds bounds, int count, MaterialPropertyBlock properties = null, ShadowCastingMode castShadows = ShadowCastingMode.On, bool receiveShadows = true, int layer = 0, Camera camera = null, LightProbeUsage lightProbeUsage = LightProbeUsage.BlendProbes, LightProbeProxyVolume lightProbeProxyVolume = null)
Parameters
Which subset of the mesh to draw. This applies only to meshes that are composed of several materials.
The bounding volume surrounding the instances you intend to draw.
The number of instances to be drawn.
Additional material properties to apply. See MaterialPropertyBlock.
Determines whether the Meshes should cast shadows.
Determines whether the Meshes should receive shadows.
If null (default), the mesh will be drawn in all cameras. Otherwise it will be drawn in the given Camera only.
LightProbeUsage for the instances.
Remarks
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.