This works if little modified, like this:
![alt text][1]
using System;
using UnityEngine;
public class GUILine
{
public static Texture2D lineTex;
public static float width=1;
public static void Draw(Vector2 pointA, Vector2 pointB)
{
Matrix4x4 matrix = GUI.matrix;
if (lineTex==null) { lineTex = new Texture2D(1, 1); }
float angle = Vector3.Angle(pointB - pointA, Vector2.right);
if (pointA.y > pointB.y) { angle = -angle; }
GUIUtility.RotateAroundPivot(angle, pointA);
GUI.DrawTexture(new Rect(pointA.x, pointA.y, (pointA-pointB).magnitude, width), lineTex);
GUI.matrix = matrix;
}
}`
[1]: /storage/temp/19659-guiline.jpg
↧