FSharp-Unity icon indicating copy to clipboard operation
FSharp-Unity copied to clipboard

Possible to get this working on Unity 5?

Open worrel opened this issue 10 years ago • 4 comments

I've attempted to follow these steps for Unity 5.0.2 on Mac with no luck. One issue is the version of FSharp.Core.dll - there does not appear to be one for 2.3.0 as mentioned in the writeup. I've tried used one from 4.0 and 4.5 also with no luck. Even downloaded the DLL from this repo. But in all cases I can't seem to build the project & my .fs files show with errors in MonoDevelop.

worrel avatar Jun 05 '15 18:06 worrel

Oh, sorry to hear that. I haven't used Unity 5 more so I'm not sure. Please tell me if you figure something out and I can put it into the guide for everyone else! Also, I guess we're all hoping that they will bump the .NET version soon so that we can use a newer version of F# etc. That might take years though, they've just said it's gonna happen at some point in the future...

eriksvedang avatar Jun 05 '15 18:06 eriksvedang

Actually I've figured this out now (on both 4.x and 5.x). The key was to stop trying to use F# DLLs installed by the Homebrew "fsharp" package, and exclusively use the libraries included with Unity in the MonoDevelop.app folder. To summarize:

For FSharp.Core, System and System.Core: /Applications/<unity_4_or_5_folder>/MonoDevelop.app/Contents/Frameworks/Mono.framework/Home/lib/mono/2.0

For UnityEngine: /Applications/<unity_4_or_5_folder>/Unity.app/Contents/Frameworks/Managed

For FSharp.Core, you need to set "Local Copy" on the reference, but not for the others. If you target the project directly into Assets, that's all you need to do. If you follow the custom build command approach, you need to make sure to copy both your library dll (MyFSharpLib.dll) and FSharp.Core to Assets (I created 2 separate after build custom commands for this).

worrel avatar Jun 08 '15 12:06 worrel

OK, great!

eriksvedang avatar Jun 09 '15 07:06 eriksvedang

Using VS Unity Extensions you can compile directly using Unity as target (using maybe only web modules etc.).

McOmghall avatar Aug 21 '16 16:08 McOmghall