LineRendererではない方法で線を書く
http://docs.unity3d.com/ScriptReference/GL.html
公式なのにC#がない・・・。
勉強しないエンジニアがよく使うUnityScriptだったのでC#にポートした。
using UnityEngine; using System.Collections; public class CreateLine : MonoBehaviour { static Material lineMaterial; static void CreateLineMaterial () { if (!lineMaterial) { lineMaterial = new Material ("Shader \"Lines/Colored Blended\" {" + "SubShader { Pass { " + " Blend SrcAlpha OneMinusSrcAlpha " + " ZWrite Off Cull Off Fog { Mode Off } " + " BindChannels {" + " Bind \"vertex\", vertex Bind \"color\", color }" + "} } }"); lineMaterial.hideFlags = HideFlags.HideAndDontSave; lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave; } } void OnPostRender () { CreateLineMaterial (); // set the current material lineMaterial.SetPass (0); GL.Begin (GL.LINES); GL.Color (new Color (1, 1, 1, 0.5f)); GL.Vertex3 (0, 0, 0); GL.Vertex3 (1, 0, 0); GL.Vertex3 (0, 1, 0); GL.Vertex3 (1, 1, 0); GL.Color (new Color (0, 0, 0, 0.5f)); GL.Vertex3 (0, 0, 0); GL.Vertex3 (0, 1, 0); GL.Vertex3 (1, 0, 0); GL.Vertex3 (1, 1, 0); GL.End (); } }