I'm having some trouble with debugging an Unity app on iOS. There is a function to draw a line on the screen, which uses a custom shader. The error I get is:
NullReferenceException
at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00000] in <filename unknown>:0
at Drawable.InitColor (Color lineColour) [0x00039] in /Users/.../Drawable.cs:269
Line 269 in Drawable.cs is:
mLineRenderer.material = new Material(Shader.Find("Custom/LineRender"));
The shader code is as follows:
Shader "Custom/LineRender"
{
Properties {
_Color ("Color", Color) = (1.0, 1.0, 1.0, 1.0)
}
SubShader {
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
LOD 200
Pass{
CGPROGRAM
#pragma surface surf Lambert
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = _Color.rgb;
o.Emission = _Color.rgb; // * _Color.a;
o.Alpha = _Color.a;
}
ENDCG
}
}
}
I don't know much about shaders, so I'm not sure what's going on here. But it worked in Unity 4.6, now it doesn't work in Unity 5. Can anyone see anything obvious that is breaking it?