Created
March 12, 2013 14:00
-
-
Save tsubaki/5143087 to your computer and use it in GitHub Desktop.
DrawMeshをシーンビューで表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
[ExecuteInEditMode] | |
public class DrawMeshOnSceneview : MonoBehaviour { | |
public Mesh mesh; | |
void OnEnable() | |
{ | |
#if UNITY_EDITOR | |
SceneView.onSceneGUIDelegate += this.OnSceneGUI; | |
#endif | |
} | |
void OnDisable() | |
{ | |
#if UNITY_EDITOR | |
SceneView.onSceneGUIDelegate -= this.OnSceneGUI; | |
#endif | |
} | |
#if UNITY_EDITOR | |
void OnSceneGUI(SceneView sceneView) { | |
Graphics.DrawMeshNow(mesh, transform.position, Quaternion.identity); | |
} | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment