I'm bashing my head against my desk trying to figure out why, after packaging this shader in asset bundles, it's showing up in my Frame Debugger as not having the correct properties, culling settings, etc. Is there something here that is incompatible with Metal? (Note: the mesh being passed in, is already in view volume coordinates and the mesh has been tested and works in another metal application on device) Code (CSharp): Shader "AFoldApart/PaperProjection/PrepareScreenOverlayWithScaledGameBlit" { // Command buffers write to global keywords so "white" will always take priority because it is more specific than the global //Properties //{ // _MainTex ("Texture", 2D) = "white" {} //} SubShader { Tags{ "Queue" = "Geometry" "PreviewType" = "Plane" } CGINCLUDE #pragma target 3.0 #include "UnityCG.cginc" struct appdata { float3 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; }; sampler2D _MainTex; v2f vert(appdata v) { v2f o; o.vertex = float4(v.vertex, 1); o.uv = v.uv; #ifndef UNITY_UV_STARTS_AT_TOP o.uv.y = 1 - o.uv.y; #endif return o; } fixed4 frag(v2f i, out float out_depth : SV_Depth) : SV_Target { out_depth = Linear01Depth(1.0); return tex2D(_MainTex, i.uv); } ENDCG Pass { ZWrite on ZTest always Cull back CGPROGRAM #pragma vertex vert #pragma fragment frag ENDCG } } } Notice that the parameters are wrong and the texture is missing. If I run without asset bundles, the texture shows up and things work as expected. On PC, Switch, XBox, and PS4, the same shader runs as expected with the same AssetBundle configuration.
I tested the shader in another project but without asset bundles and it ran on device. It seems that there is something about the asset bundle that's corrupting the shader. Again, this seems unusual because this asset bundle configuration runs fine on every console and PC.
I solved it! There was a two-fold solution. 1. I added the shaders to the Always Include list (even though this was not required on Mac, PC, Switch, XBox, or PS4) 2. I deleted ALL my asset bundles and rebuilt them. I had previously tried rebuilding only the bundles that contained the shaders, but apparently once you add something to the Always Include list, you need to rebuild all the bundles for iOS (according to another thread). Later, I will do a sanity check to make sure that step 1 was actually required and there wasn't just some weird corruption of my bundles. I think I had done a full rebuild to test, and it failed, but I am not certain. It was late and I was tired.