Sunday, April 9, 2017

No, Virginia, You Can't Actually Write Unity Apps for HoloLens in F#

After starting on a Conway 3D Game of Life for HoloLens in F#, and experiencing a crash related to IL2CPP, I filed a bug with Unity. In response, I got bad news:

The error occurs because IL2CPP limits the recursion depth of generics to seven levels currently. Unfortunately, this is is not an error which is reported well the version of Unity you are using. The most recent Unity patch releases handle this error case better by throwing a managed exception. 
However, that does not correct the root issue. Often with F# code we see deeply nested generic type and method hierarchies which hit this limit. Can you use a different library, not written in F#? Since F# is not a supported scripting language in Unity, we don't plan to actually correct this bug.
This effectively means F# is out for writing HoloLens apps, or even Unity apps at all, since Unity plans to move its scripting back-ends to IL2CPP entirely in the near future.

You can up vote the bug here if you think we can get Unity to change their mind. Turns out you can't even up vote the bug since it's been marked resolved. However, you can vote for Unity F# support here.

Addendum: It's worth noting that F# support is currently Unity's seventh-most requested feature.