Can't find shader on iOS - GpuProgram creation error: shader program type is unrecognised.

I’m working on an open-source Unity project and am having a hard time getting it to work properly on iOS. I don’t expect people to know the application, but it’s called UnityMol.

The problem I’m dealing with is that there is at least one shader (see attachment) that seems to have some kind of problem and cannot be loaded on iOS. I’m running the Xcode project built by Unity on my iPad and whenever Shader.Find() is used to find this shader, the message GpuProgram creation error: shader program type is unrecognised. You might have a precompiled shader asset from an old Unity version. is logged and I imagine the shader is not found, as the objects it should be applied upon end up pink. This same message is logged many times in the console during the build of the Xcode project, but as a warning, not an error.

From the message, it seems that I should recompile the shader - I tried it by selecting the file and choosing “Reimport” on its context menu, but it doesn’t seem to have any effect. I also tried creating a new shader with the same code, but different name - again, the problem remains.

When running the application on the Unity Editor or building the application for Windows or OS X, this problem doesn’t happen.

What is happening and how can I fix it?

Tools and settings:

  • Unity: 5.4.1
  • Xcode: 7.3.1
  • Device: iPad Mini 4 FK6L2LL/A (iOS 9.3.2)
  • Rendering path: Forward
  • Graphics API: Metal
  • Static Batching, Dynamic Batching, GPU Skinning, Graphics Jobs: NO
  • Scripting backend: IL2CPP
  • Target Device: iPad Only
  • Target SDK: Device SDK
  • Target Minimum iOS Version: 9.0
  • Preload Shaders: NO

None of these settings is set in stone. If it’s necessary to change any of them in order to get this shader to work, there is no problem.
[80909-stickimproved2.txt|80909]

Try to add your shaders into ‘Always included shaders’ at Edit → Project Settings → Graphics

Answering amitshah’s comment, this is how I ended up “fixing” the problem:

  • Disabled “Auto Graphics API”;
  • Added OpenGLES3 and Metal to “Graphics API”;

After this, the shader that was giving me trouble stopped doing it and executed correctly on my iPad mini 4 with iOS 9.3.2.

Here are my iOS Player Settings: