Version: 2022.1
言語: 日本語
public static void DrawMesh (Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera= null, int submeshIndex= 0, MaterialPropertyBlock properties= null, bool castShadows= true, bool receiveShadows= true, bool useLightProbes= true);
public static void DrawMesh (Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, Rendering.ShadowCastingMode castShadows, bool receiveShadows= true, Transform probeAnchor= null, bool useLightProbes= true);
public static void DrawMesh (Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera= null, int submeshIndex= 0, MaterialPropertyBlock properties= null, bool castShadows= true, bool receiveShadows= true, bool useLightProbes= true);
public static void DrawMesh (Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, Rendering.ShadowCastingMode castShadows, bool receiveShadows= true, Transform probeAnchor= null, bool useLightProbes= true);
public static void DrawMesh (Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, Rendering.ShadowCastingMode castShadows, bool receiveShadows, Transform probeAnchor, Rendering.LightProbeUsage lightProbeUsage, LightProbeProxyVolume lightProbeProxyVolume= null);

パラメーター

mesh 描画する Mesh
position メッシュの位置
rotation メッシュの角度
matrix メッシュの変換行列 (位置、回転やその他の変換を組み合わせます) 。
material 使用する Material
layer Layer the mesh is drawn on.
camera If null (default), the mesh will be drawn in all cameras. Otherwise it will be rendered in the given Camera only.
submeshIndex 描画するメッシュのサブセット。これはいくつかのマテリアルで構成されるメッシュにのみ適用されます。
properties このメッシュを描画する前にマテリアルに適用するマテリアルプロパティーを追加します。 MaterialPropertyBlock を参照してください。
castShadows Determines whether the mesh can cast shadows.
receiveShadows Determines whether the mesh can receive shadows.
useLightProbes メッシュはライトプローブを使用するか。
probeAnchor これを設定すると、ライトプローブをサンプリングし合致するリフレクションプローブを見つけるために、メッシュは Transform の位置を使用します。
lightProbeUsage LightProbeUsage for the mesh.

説明

メッシュを描画する

This function is now obsolete. Use Graphics.RenderMesh instead.

DrawMesh draws a mesh for one frame. The mesh will be affected by the lights, can cast and receive shadows and be affected by Projectors - just like it was part of some game object. It can be drawn for all cameras or just for some specific camera.

Use DrawMesh in situations where you want to draw large amount of meshes, but don't want the overhead of creating and managing game objects. Note that DrawMesh does not draw the mesh immediately; it merely "submits" it for rendering. The mesh will be rendered as part of normal rendering process. If you want to draw a mesh immediately, use Graphics.DrawMeshNow.

Because DrawMesh does not draw mesh immediately, modifying material properties between calls to this function won't make the meshes pick them up. If you want to draw series of meshes with the same material, but slightly different properties (e.g. change color of each mesh), use MaterialPropertyBlock parameter.

この呼出しはメッシュがレンダリングのために待機している間に、内部リソースを作成します。アロケーションは即座に発生しフレームの最後まで (オブジェクトがすべてのカメラに対して待機している場合)、または、指定されたカメラがそれ自体を描画するまで保たれます。

See Also: Graphics.RenderMesh, MaterialPropertyBlock.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Mesh mesh; public Material material; public void Update() { // will make the mesh appear in the Scene at origin position Graphics.DrawMesh(mesh, Vector3.zero, Quaternion.identity, material, 0); } }