Search Feedback

3223
votes

F# support

Scripting

-

-

F# is rapidly gaining popularity in the .NET community. There are several game developers who are using it outside Unity, and even Xamarin products now support it.

It would be nice to be able to use F# for scripting in Unity.

Comments (34)

  1. F59b4b8fb96df7f5f721e715d43175da?d=mm

    4nntt

    Dec 10, 2014 16:56

    It would be nice to see support for any .net language without having to import a dll. Maybe with some sort of editor plugin. Personally I'd like to see some sort of partnership with RemObjects to bring Silver (Apple Swift for .net) as a native supported language. Since I use Swift for my day job, it would be nice to also use it for Unity. There are a lot of Unity developers coming from the Mac platform. I think it would be cool to see both C# and Silver as primary languages. F# would be cool as an official language too. Functional languages are well suited for game design.

  2. A266827481c20c039c073fb93cea715e?d=mm

    LSPressWorks

    Aug 27, 2014 05:46

    I wish I could vote down on this one. We already have 3 languages, all of which need work in terms of how well they play together, and how well mono deals with them. Once they are all 100% cross functional and bug free then yeah...

  3. 7e2b8bf3ae78a88c2ccd49805df19ac4?d=mm

    MiloDCooper

    Jun 03, 2014 23:42

    F# works, though not perfectly; for example, I built a project using F# in which Seq.sort ran fine on Android, but it crashed under iOS. Wound up having to code a work-around in C# for iOS devices.

    Also, it would be great to have debugging capability for F# code. Building a DLL works fine, but you can't pause execution in code, that way.

    F# is the future, as far as I'm concerned. If you look at Swift (Apple's new programming language, meant as the successor to Objective-C), it looks and functions a lot like F#, even more than it does C#. Critical mass toward F# is building up and up; it's a very efficient, powerful, clean, and FUN way to code, and as good as C# is (great language), once you try F# for a short while, you can't go back.

    Here's hoping for full support for F# in Unity!

  4. 3d0362d4928b71afaf8d34fb82503eaa?d=mm

    Abscissa

    Oct 17, 2013 13:48

    You should already be able to.

    Just write your scripts in F# (in any text/code editor), and compile them to a dll (with any F# compiler, making sure to include "[Where you installed Unity]/Editor/Data/Managed/UnityEngine.dll" as a dependency). Then add the dll to your project's Assets directory.

    After doing that, your dll will show up inside the Unity editor with a little "expand" arrow next to it, clicking it will show all the scripts inside it (ie classes inherited from MonoBehavior) and you can attach them to game objects just like you would a C#/Boo/JS script.

    I've already tried this using the Nemerle language and it works fine. It should work fine with any CLI/.NET/Mono-based language.

    If you're using the command-line F# compiler and you need a better idea of what commandline arguments to pass, you can check what Unity does by opening an existing C#/Boo/JS Unity script in MonoDevelop, build the project ("Build" -> "Build All"), and then click on the bottom status bar where it says "Build successful" or "Build: # error, # warning" to bring up the error panel. On that error panel, click the "Build Output" button to see all the commands that were used to build. Adapt those to your project and whatever compiler you're using.

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(9110)

2D

(224)

Ads

(40)

AI & Navigation

(68)

Analytics

(96)

Animation

(309)

Asset Store

(229)

Assets

(493)

Audio

(158)

Cloud Build

(95)

Collaborate

(32)

Docs & Tutorials

(198)

Editor

(2102)

Everyplay

(13)

Game Performance Reporting

(13)

General

(819)

Graphics

(768)

GUI

(365)

Input

(146)

Licensing

(75)

Networking

(158)

Physics

(343)

Platforms

(405)

Profiling & Optimization

(69)

Runtime

(162)

Scripting

(1022)

Terrain

(150)

WebGL

(131)