言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Graphics.DrawMesh

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function DrawMesh(mesh: Mesh, matrix: Matrix4x4, material: Material, layer: int, camera: Camera, submeshIndex: int, properties: MaterialPropertyBlock, castShadows: bool, receiveShadows: bool): void;
public static void DrawMesh(Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows, bool receiveShadows);
public static def DrawMesh(mesh as Mesh, matrix as Matrix4x4, material as Material, layer as int, camera as Camera, submeshIndex as int, properties as MaterialPropertyBlock, castShadows as bool, receiveShadows as bool) as void

Parameters

mesh 描画する Mesh
position メッシュの位置
rotation メッシュの角度
matrix Transformation matrix of the mesh (combines position, rotation and other transformations).
material 使用する Material
layer 使用する Layer
camera 特定のカメラで描画する場合のみ、設定します。デフォルトは null で、すべてのカメラで描画されます
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?

Description

メッシュを描画する

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 up them. 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: MaterialPropertyBlock.

	// Draws aMesh with aMaterial at (0,0,0) with no rotation for one frame

	var aMesh : Mesh;
	var aMaterial : Material;

	function Update() {
		Graphics.DrawMesh(aMesh, Vector3.zero, Quaternion.identity, aMaterial, 0);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Mesh aMesh;
    public Material aMaterial;
    void Update() {
        Graphics.DrawMesh(aMesh, Vector3.zero, Quaternion.identity, aMaterial, 0);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public aMesh as Mesh

	public aMaterial as Material

	def Update() as void:
		Graphics.DrawMesh(aMesh, Vector3.zero, Quaternion.identity, aMaterial, 0)