I have done a bit more digging and come to the conclusion it is not the shader code.
Its whenever i change the material’s shader in code that it doesnt seem to work. The shader doesnt matter as I have assigned the shader i switch to to the default shader.
Are you by any chance getting your shader reference from code by using Shader.Find (and not using a drag’n’drop reference)? If that is the case, be sure to put your shader files in a folder called Resources. It is mentioned in the scripting reference for Shader.Find.
As for the why: If you didn’t assign it anywhere, it won’t be part of the build so you can’t use it.
The content of the resource folder is always part of the build, independent if it is used anywhere through editor assignements or not.