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.
Addendum: It's worth noting that F# support is currently Unity's seventh-most requested feature.
I'm the Unity developer who responded with the bad news above.
ReplyDeleteIf 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.
Hi Josh,
ReplyDeleteThanks 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.