Wireframe

Hey guys I am trying to use this wireframe code I found. It works on the desktop but when I try to put onto mobile it doesnt show up (although it does in the editor – even with graphic emulation set to es2), I assume it has something to do with the material

var lineColor : Color = Color.green; 
var backgroundColor : Color = Color.black; 
var ZWrite = true; 
var AWrite = true; 
var blend = true; 
 
private var lines : Vector3[]; 
private var linesArray : Array; 
private var lineMaterial : Material; 
private var meshRenderer : MeshRenderer; 
 
 
function Start () 
{ 
	if(renderer)
    renderer.enabled = false;
   meshRenderer = GetComponent(MeshRenderer); 
   if(!meshRenderer) meshRenderer = gameObject.AddComponent(MeshRenderer); 
   meshRenderer.material = new Material("Shader \"Lines/Background\" { Properties { _Color (\"Main Color\", Color) = (1,1,1,1) } SubShader { Pass {" + (ZWrite ? " ZWrite on " : " ZWrite off ") + (blend ? " Blend SrcAlpha OneMinusSrcAlpha" : " ") + (AWrite ? " Colormask RGBA " : " ") + "Lighting Off Offset 1, 1 Color[_Color] }}}"); 
 
// Old Syntax without Bind :    
   //lineMaterial = new Material("Shader \"Lines/Colored Blended\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha ZWrite On Cull Front Fog { Mode Off } } } }"); 
 
// New Syntax with Bind : 
  lineMaterial = new Material("Shader \"Lines/Colored Blended\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha BindChannels { Bind \"Color\",color } ZWrite On Cull Front Fog { Mode Off } } } }"); 
 
   lineMaterial.hideFlags = HideFlags.HideAndDontSave; 
	lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave; 
 
   linesArray = new Array(); 
   var filter : MeshFilter = GetComponent(MeshFilter); 
   if(filter)
   {
	   var mesh = filter.sharedMesh; 
	   var vertices = mesh.vertices; 
	   var triangles = mesh.triangles; 
	 
	   for (var i = 0; i < triangles.length / 3; i++) 
	   { 
	      linesArray.Add(vertices[triangles[i * 3]]); 
	      linesArray.Add(vertices[triangles[i * 3 + 1]]); 
	      linesArray.Add(vertices[triangles[i * 3 + 2]]); 
	   } 
	 
	   lines = linesArray.ToBuiltin(Vector3); 
	}
} 
 
 
function OnRenderObject() 
{    
	if(meshRenderer  lines  lines.Length>0)
	{
	   meshRenderer.sharedMaterial.color = backgroundColor; 
	   lineMaterial.SetPass(0); 
	 
	   GL.PushMatrix(); 
	   GL.MultMatrix(transform.localToWorldMatrix); 
	   GL.Begin(GL.LINES); 
	   GL.Color(lineColor); 
	 
	   for (var i = 0; i < lines.length / 3; i++) 
	   { 
	      GL.Vertex(lines[i * 3]); 
	      GL.Vertex(lines[i * 3 + 1]); 
	 
	      GL.Vertex(lines[i * 3 + 1]); 
	      GL.Vertex(lines[i * 3 + 2]); 
	 
	      GL.Vertex(lines[i * 3 + 2]); 
	      GL.Vertex(lines[i * 3]); 
	   } 
	 
	   GL.End(); 
	   GL.PopMatrix(); 
	 }
}

Turns out it was an easy fix in case anyone else wants it.

I tried this one and it worked nice, but the only ‘issue’ I found is that the background color is not honored. Other than that is relatively fast and works fine.