Quick answer: Unreal Material Custom HLSL node compiling on PC but red-screened on mobile preview? Mobile uses GLSL-translated HLSL with stricter rules - avoid samplers in custom code or use Mobile Compatibility.

Custom HLSL node samples a texture directly. PC: fine. Mobile preview: error: variable 'tex' has no allocated storage.

Pass via Texture Object

Don't reference textures directly in HLSL. Add a Texture Object pin; UE translates the bind for mobile's GLSL pipeline.

Mark for Mobile compatibility

Material details > Mobile > Use Full Precision. Forces fp32; some HLSL idioms fail at fp16 default.

Test on actual device

Mobile preview is approximate. ES3.1 on a Pixel 6 and Metal on an iPhone behave differently than the preview. Run on hardware before assuming the fix.

“Custom HLSL is a leaky abstraction. Mobile makes the leaks visible.”

Keep custom HLSL minimal. Most things can be expressed as material nodes; reserve HLSL for genuinely novel math.