Hi there, I've searched the forum but haven't found a reasonable answer.
I would like to know, how to create and manipulate a LINE.
I would like to have that rendered in realtime in the main camera/game camera.
I would like to edit the endpoints of the line or have access to edit those positions, for example get the positions of 2 objects in 3d space and use them to create the line.
I would like to edit the colors and thicnkess of the line.
I had the same sort of issue (Unity doesn’t really document how to access the variables from a script), but here’s a little script I put together just to illustrate how this works (in javascript):
#pragma strict
var vertexList = new Array();
var lr : LineRenderer;
function Start () {
vertexList.push(Vector3(0, 0, 0));
vertexList.push(Vector3(2, 4, 0));
vertexList.push(Vector3(4, 0, 0));
lr.SetVertexCount(vertexList.length);
for(var i=0; i<vertexList.length; i++){
lr.SetPosition(i, vertexList*);*
} } Basically just populates an array of Vector3s and sets them as the Line Renderers’s vertices, then draws them. Hope this helps.