[SOLVED] Arrays in shader cause runtime compilation error on Android (OpenGL ES 3.2)

I have added support for multiple lights to my shader (via arrays). This works fine using OpenGL on PC. However, when I try running it on Android (Pixel C with OpenGL ES 3.2), I get the following error:

Unhandled Exception:

System.InvalidOperationException: Shader Compilation Failed

Any ideas as to why that might not be working on Android? Removing the arrays gets everything working just fine.


Figured out the problem… it wasn’t the array that was the problem, it was the loops.

To get this to work, I had to unroll the loops using [unroll(MAX_LIGHTS)]

1 Like