iOS Crash when use custom shader

Hi everyone,

I am using a shader tht i downloaded somewhere and it work perfectly fine on my iPhone 4s.
But it is a little bit too much for my need, so i decided to duplicate it and make a mobile friendly version for better perf.

So i have CustomShader that work perfectly fine on Editor and my iPhone.
But if i try to duplicate and rename the shader to CustomShaderMobile (without changing anything inside the shader itself) it will crash on my iPhone!

I have absolutely no idea why…
I really didn’t change anything except the name…

So my shader name is CustomShderMobile and the path is exactly the same
Shader “ProjectName/CustomShderMobile”

Also, i am creating the shader at runtime with the function Find.
Material material = new Material(Shader.Find(“ProjectName/CustomShderMobile”));

Does that make any difference ?

I really don’t know whats happen because it is running fine in the editor…
Any help would be appreciated.

Best regards.

You could try putting the shader into the “Resources” folder. If a shader isn’t assigned to any material and isn’t in the “Resources” folder Unity will optimize the build by not including it. So using Find to load it will fail.

TheShane, thank you so much for taking time to answer!
What you explained is exactly what’s happened!
I moved my shader in the resource folder and now everything is working perfectly!
Thanks a ton!