DrawMeshNow
Draw a mesh immediately.
Read time 3 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
DrawMeshNow(Mesh, Vector3, Quaternion, int)
Draw a mesh immediately.
public static void DrawMeshNow(Mesh mesh, Vector3 position, Quaternion rotation, int materialIndex)
Parameters
Position of the mesh.
Rotation of the mesh.
Subset of the mesh to draw.
Remarks
This function will draw a given mesh immediately. Currently set shader and material (see Material.SetPass) will be used.
The mesh will be just drawn once, it won't be per-pixel lit and will not cast or receive real-time shadows. If you want full integration with lighting and shadowing, use Graphics.DrawMesh instead.
using UnityEngine;using System.Collections;// Attach this script to a Camerapublic class ExampleClass : MonoBehaviour { public Mesh mesh; public Material mat; public void OnPostRender() { // set first shader pass of the material mat.SetPass(0); // draw mesh at the origin Graphics.DrawMeshNow(mesh, Vector3.zero, Quaternion.identity); }}
Additional Resources: Graphics.DrawMesh, Material.SetPass.
DrawMeshNow(Mesh, Matrix4x4, int)
Draw a mesh immediately.
public static void DrawMeshNow(Mesh mesh, Matrix4x4 matrix, int materialIndex)
Parameters
Remarks
This function will draw a given mesh immediately. Currently set shader and material (see Material.SetPass) will be used.
The mesh will be just drawn once, it won't be per-pixel lit and will not cast or receive real-time shadows. If you want full integration with lighting and shadowing, use Graphics.DrawMesh instead.
using UnityEngine;using System.Collections;// Attach this script to a Camerapublic class ExampleClass : MonoBehaviour { public Mesh mesh; public Material mat; public void OnPostRender() { // set first shader pass of the material mat.SetPass(0); // draw mesh at the origin Graphics.DrawMeshNow(mesh, Vector3.zero, Quaternion.identity); }}
Additional Resources: Graphics.DrawMesh, Material.SetPass.
DrawMeshNow(Mesh, Vector3, Quaternion)
Draw a mesh immediately.
public static void DrawMeshNow(Mesh mesh, Vector3 position, Quaternion rotation)
Parameters
Position of the mesh.
Rotation of the mesh.
Remarks
This function will draw a given mesh immediately. Currently set shader and material (see Material.SetPass) will be used.
The mesh will be just drawn once, it won't be per-pixel lit and will not cast or receive real-time shadows. If you want full integration with lighting and shadowing, use Graphics.DrawMesh instead.
using UnityEngine;using System.Collections;// Attach this script to a Camerapublic class ExampleClass : MonoBehaviour { public Mesh mesh; public Material mat; public void OnPostRender() { // set first shader pass of the material mat.SetPass(0); // draw mesh at the origin Graphics.DrawMeshNow(mesh, Vector3.zero, Quaternion.identity); }}
Additional Resources: Graphics.DrawMesh, Material.SetPass.
DrawMeshNow(Mesh, Matrix4x4)
Draw a mesh immediately.
public static void DrawMeshNow(Mesh mesh, Matrix4x4 matrix)
Parameters
Remarks
This function will draw a given mesh immediately. Currently set shader and material (see Material.SetPass) will be used.
The mesh will be just drawn once, it won't be per-pixel lit and will not cast or receive real-time shadows. If you want full integration with lighting and shadowing, use Graphics.DrawMesh instead.
using UnityEngine;using System.Collections;// Attach this script to a Camerapublic class ExampleClass : MonoBehaviour { public Mesh mesh; public Material mat; public void OnPostRender() { // set first shader pass of the material mat.SetPass(0); // draw mesh at the origin Graphics.DrawMeshNow(mesh, Vector3.zero, Quaternion.identity); }}
Additional Resources: Graphics.DrawMesh, Material.SetPass.