Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created March 12, 2013 14:00
Show Gist options
  • Save tsubaki/5143087 to your computer and use it in GitHub Desktop.
Save tsubaki/5143087 to your computer and use it in GitHub Desktop.
DrawMeshをシーンビューで表示
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