- Home /
Question by
ardy3344 · Aug 02, 2011 at 09:05 AM ·
materiallinerenderer
how change linerenderer with png or material....
i want change color with material or png how way??? so when launch the linerender become texture in the material...
i use the code
var c1 : Color ;
var c2 : Color ;
var lengthOfLineRenderer : int ;
var materials : Material[];
function Start()
{
var lineRenderer : LineRenderer = gameObject.AddComponent(LineRenderer);
lineRenderer.material = new Material (Shader.Find("Particles/Additive"));
lineRenderer.SetColors(c1, c2 );
lineRenderer.SetWidth(0.4,0.4);
lineRenderer.SetVertexCount(lengthOfLineRenderer);
}
function Update()
{
var lineRenderer : LineRenderer = GetComponent(LineRenderer);
for(var j : int = 2; j < lengthOfLineRenderer; j++)
{
var pos1 : Vector3 = Vector3(j* -1*1,j,0);
lineRenderer.SetPosition(j, pos1);
}
}
Can you help me???
Comment
Your answer
Follow this Question
Related Questions
Draw trail behind player when its not moving 0 Answers
UI LineRenderer Antialaing/masking issue 0 Answers
Issue with close point in line renderer 1 Answer
ShaderGraph Material Color change. 0 Answers