iOS simple shader does not work

Hi

I have been on this for days without any ideas come up. I wrote a very simply shader to draw a line using vertex.

Shader “Custom/LineShader” {

Properties
{
_Color (“Color”, Color) = (1, 1, 1)
}

SubShader
{
Color[_Color]
Pass{}
}
}

And instantiate material with this shader

lineRenderer = line.AddComponent(LineRenderer);

var lineShader = Shader.Find(“Custom/LineShader”);

var lineMaterial = new Material(lineShader);

lineRenderer.material = lineMaterial;

lineRenderer.material.color = color;

These code work well on Editor (even with iOS platform switched on) but when deploying on iPad, all the line is just black no matter color i tried to set, i attach debugger and dont find any color property of this material. What happen? i think it should be very simple but it is not. Any recommendation would be so helpful now because i really out of idea. Thanks

Unity does not include any resources that are not directly referenced, but referencing them by code doesn’t count since there is no good way for Unity to tell. So you need to have the shader be used in a material that’s used on an object in the scene, or else put the shader in the Resources folder, since everything in Resources is included in a build regardless of whether it’s directly referenced or not.