Unity3D Supports All .NET/CLR/Mono Languages


I've noticed there's a very common belief in the community that Unity3D can be used with exactly three languages: C#, JavaScript and Boo. (Well, plus C++ if you count Unity's "native plugins" - but there are various issues with that.)

That myth needs to be dispelled.

Yes, Unity only claims to support those specific languages, but the fact is, Unity knows nearly jack about any of them. It knows how to invoke their compilers, but that's about it. What Unity does know however, is Mono. Mono is what Unity uses for scripting, not C#, not JavaScript, not Boo.

Mono, of course, is an alternate implementation of .NET's CLR and libraries. As such, Mono, and therefore Unity3D, will happily run software written in any CLR/.NET/Mono-based language. Such as F# or VB.NET or Nemerle. Personally, I use Nemerle for my Unity work.

So how do you do it? Two steps:

1. Compile your code to a .NET assembly using any compiler for any .NET/CLR/Mono language you dang well choose.

2. Put the resulting DLL into your Unity project's Assets folder.

Simple.

And thanks to the metadata embedded into .NET assemblies, even your public fields will still show up, fully editable as ever, in the Unity editor.

Just because the Create Asset menu only shows C#, JavaScript and Boo doesn't mean that's all you can use. My car stereo lacks a button for "Play Duran Duran" and yet their Rio disc works just fine. Amazing!

On a related note: People, just because Unity automatically launches MonoDevelop when you tell it to edit your code, doesn't mean you actually have to use MonoDevelop to edit your code. Don't like MonoDevelop? Fine. Use something else. Pretty simple solution, huh? (Don't know how? Then I suggest starting with this. You may think I'm joking, but you'd be surprised how many professional programmers don't know how to use a computer.) Personally, I use Programmer's Notepad 2 for code editing, but there are plenty of choices out there.

4 comments for "Unity3D Supports All .NET/CLR/Mono Languages"

  1. (Guest) guest
    2014-01-18 08:34

    Yes, but you only get debugging with MonoDevelop, which sucks immensely

  2. 2014-01-28 01:35

    Granted, there is that. But of course you can still edit in whatever and just switch to MonoDevelop when you need to debug. Not ideal, but still entirely workable.

  3. (Guest) wifi hack
    2014-10-10 04:48

    Hi to every one, because I am actually eager of
    reading this web site's post to be updated daily.
    It includes good data.

  4. (Guest) Oleg
    2014-11-13 03:04

    http://unityvs.com/ - here is free version of plugin that integrated Visual Studio and Unity3d heavily, making it much better than Monodevelop, providing a lot of features that MonoDevelop doesn't(and debug is there too ofc).

    http://www.visualstudio.com/news/vs2013-community-vs - here is free visual studio 2013 with all features of professional and it supports that plugin.

    So don't say that you don't any other solutions. Peace.

Leave a comment

Captcha