Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.