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.


  1. I'm the Unity developer who responded with the bad news above.

    If F# support is something that many people want, we can put effort into making it work. So please vote this feature up! In the past, we've not seen a large number of developers interested in F# support for games.

    We have done some rudimentary work for F# support in IL2CPP, but it is not a priority now for Unity in general, so we don't put too many resources toward it, as evidenced by my statement.

  2. Hi Josh,

    Thanks for your comment! From what I can see, F# support now has over 2100 votes on the feedback site, which puts it at your sixth most-requested feature. But we'll see where the numbers go now after my post.