- Home /
Question by
zyonneo · Sep 16, 2019 at 10:24 AM ·
unity 5linerendererline drawing
How to draw a line with arrow mark in unity?
I was looking to draw a line which contains an arrow mark.How to show it with arrow on head is a problem. Is it possible to do without line renderer?Was looking for something like this.I was looking to adjust the length by swiping on the screen.I tried with Line Renderer between two points,but with arrow mark it was not possible.
if (Input.GetTouch(0).phase == TouchPhase.Began)
{
//--Clearing the list and adding first touch to list--
fingerPositions.Clear();
fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
Debug.Log("Made first touch");
click = true;
}
if (Input.GetTouch(0).phase == TouchPhase.Moved)
{
isSwiping = true;
}
if (Input.GetTouch(0).phase == TouchPhase.Ended && isSwiping == true)
{
//--Adding the last touch to the list--
fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
//currenline is GameObject
currenline = Instantiate(linePrefab, fingerPositions[0], Quaternion.identity);
getAllLines.Add(currenline);
//NewLine is a LineRenderer
NewLine = currenline.GetComponent<LineRenderer>();
Debug.Log("Finger count = "+fingerPositions.Count);
NewLine.SetPosition(0, fingerPositions[0]);
NewLine.SetPosition(1, fingerPositions[1]);
isSwiping = false;
}
Comment
Your answer
