UnityEngine.Graphics.DrawMesh C# (CSharp) Method

DrawMesh() public static method

Draw a mesh.

public static DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, [ camera, [ submeshIndex, [ properties, [ castShadows, [ receiveShadows, [ useLightProbes ) : void
mesh Mesh The Mesh to draw.
position Vector3 Position of the mesh.
rotation Quaternion Rotation of the mesh.
material Material Material to use.
layer int to use.
camera [ If null (default), the mesh will be drawn in all cameras. Otherwise it will be rendered in the given camera only.
submeshIndex [ Which subset of the mesh to draw. This applies only to meshes that are composed of several materials.
properties [ Additional material properties to apply onto material just before this mesh will be drawn. See MaterialPropertyBlock.
castShadows [ Should the mesh cast shadows?
receiveShadows [ Should the mesh receive shadows?
useLightProbes [ Should the mesh use light probes?
return void
        public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, [UnityEngine.Internal.DefaultValue("null")] Camera camera, [UnityEngine.Internal.DefaultValue("0")] int submeshIndex, [UnityEngine.Internal.DefaultValue("null")] MaterialPropertyBlock properties, [UnityEngine.Internal.DefaultValue("true")] bool castShadows, [UnityEngine.Internal.DefaultValue("true")] bool receiveShadows, [UnityEngine.Internal.DefaultValue("true")] bool useLightProbes)
        {
            DrawMesh(mesh, position, rotation, material, layer, camera, submeshIndex, properties, !castShadows ? ShadowCastingMode.Off : ShadowCastingMode.On, receiveShadows, null, useLightProbes);
        }

Same methods

Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [ receiveShadows, [ probeAnchor, [ useLightProbes ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows, Transform probeAnchor ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows, bool receiveShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, [ camera, [ submeshIndex, [ properties, [ castShadows, [ receiveShadows, [ useLightProbes ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, int materialIndex ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [ receiveShadows, [ probeAnchor, [ useLightProbes ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows, Transform probeAnchor ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows, bool receiveShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, int materialIndex ) : void

Usage Example

        public void DrawUserIndexedPrimitives(PrimitiveType primitiveType, VertexPositionColorTexture[] vertexData, int vertexOffset, int numVertices, short[] indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration)
        {
            Debug.Assert(vertexData != null && vertexData.Length > 0, "The vertexData must not be null or zero length!");
            Debug.Assert(indexData != null && indexData.Length > 0, "The indexData must not be null or zero length!");

            var material = _materialPool.Get(Textures[0]);

            var mesh = _meshPool.Get(primitiveCount / 2);

            mesh.Populate(vertexData, numVertices);

            UnityGraphics.DrawMesh(mesh.Mesh, _matrix, material, 0);
        }
All Usage Examples Of UnityEngine.Graphics::DrawMesh