Mubir
Mubir

Reputation: 63

Line renderer is not working for android build game

In my game when i run the game in unity editor in unity remote the linerneder shows like below **enter image description here**

But when I build it and run it in android device the linerender disappers like below enter image description here

code for line renderer is below:

var targetObject : GameObject;
private var lineRenderer : LineRenderer;

function Start() {
    lineRenderer = GetComponent(LineRenderer);
  }

 function Update () {
    lineRenderer.SetPosition(0,this.transform.localPosition);
    lineRenderer.SetPosition(1,targetObject.transform.localPosition);
}

I have no idea what is the problem .Please help me with it

Upvotes: 1

Views: 2920

Answers (1)

ZurdoRod
ZurdoRod

Reputation: 11

If you're using

LineRenderer.material = new Material (Shader.Find("#SHADERNAME"));

you will receive an error and the LineRenderer will not work correctly.

I solve the problem creating a material, assign a proper shader (I use shader -> Particles -> Additive), and, in the script, LineRenderer.material = Resources.Load ("#PATH TO YOUR MATERIAL") as Material.

You can see other options here:

http://answers.unity3d.com/questions/1079400/linerenderer-doesnt-work-in-build.html

Upvotes: 0

Related Questions