Using .Net, not Mono, on Windows targets

Got a semi-theoretical question here. Let’s say I’m building a simulation app and targetting Windows only. Is there a way to tell Unity to use .Net and not Mono?

Yes, in my experience it is a bad idea to use .Net under Windows and Mono under Mac. I’ve done a ton of cross-platform C# development and know very well first hand that if possible use Mono on all platforms as it will save a ton of headaches.

But if I was only going to target and support Windows, there are a lot of reasons why I’d want the .Net runtime to be used and not the Mono runtime (of course, there also reasons to the contrary, most dealing with distribution/installation, but in this case that is a non-issue (ie internal release)).

Is this possible, and if not has it been requested as a feature? I could see this being useful, especially for Unity servers and people who have their own C# socket scripts, as async sockets under .Net blow away their Mono cousins in terms of performance.

Ryan

You can not use MS .NET Frameworks
Your code will be run within Mono from Unity.

What you can do is use .NET 2.0 libraries you wrote within Unity as long as they don’t have depenencies to MS .NET only / non-mono 1.2.5 frameworks

Thanks for the reply. That’s not suprising. But what was suprising was…

Mono 1.2.5?!?!?!

2007 called and wants it’s Mono back.

:wink:

Seriously, 2.4 has been shipping since March or April. 2.0 has been out for over a year. There are lots of runtime bug fixes as well as some performance improvements with 2.0. Not to mention all of the new classes you could use.

It isn’t like it costs any money to license, just engineering time to integrate, and the integration should be fairly straight forward (I’ve migrated many apps from 1.1 to 1.2 and then to 2.x with very little effort). I understand that every dev hour spent on this means a dev hour not being spent on some other new feature, but this is one that should be slam dunk and have substantial ROI.

I understand that I can use either compiler and target eithe runtime as long as the target libraries are up to snuff. But the fact is that the MS jitter (not-econo) significantly outperofrms the Mono jitter on the Windows platform:

  1. it JIT compiles faster
  2. the native code tends to be more efficient, despite being compiled more quickly
  3. the .Net library implementations have MASSIVE performance enhancements in some cases
  4. the .Net library implementations have far fewer bugs

I’m not saying Mono is bad, it isn’t.

I’m also not saying that for Windows .Net should be used exclusively, as that would suck from a support standpoint. If I was supporting both a Mac and Windows build of my game, I absoultey would want it to work the way it does today, as it will be easier for me, and easier for Unity.

However, for those who are targetting and testing on Windows only (ie 94% home market share), there are many significant advantages with providing an option to target the MS .Net runtime.

The Mono compiler can still be used at project build time. I’ve done extensive testing with this for my book, and the bulk of the advantages come from the differences in the runtime JIT and library; the IL compilation makes very little difference in comparison for Mono vs. .Net.

Even if this option was only available in the Windows version of Unity that would be fine, but I see no reason to limit it (and in fact it would probably be more work to implement it that way).

Heck, I’d even be happy if it was only a Pro feature. Give people yet another reason to go Pro and further distinguish the offerings.

It also isn’t just about raw performance and fewer bugs. There are TONS of new runtime features that simply don’t exist in Mono…especially archaic 1.2.x. If this work was done in conjunction with moving to Mono 2.x, it would really open up the programming options. They are indeed two separate things though, and if I had my choice I do think moving to 2.x first is a far more important.

I think this would be a great Pro feature. I would simply put a checkbox “Target .Net Runtimes (Windows Only)” in the UI that is enabled only in Pro and only when doing the Windows target build.

Is there any way to submit this formally as a feature request?

Ryan

http://feedback.unity3d.com/pages/15792-unity/suggestions/158233-scripting-upgrade-mono-to-2-4-2-6?ref=title

A) They’re on it
B) It’s not that simple

–Eric

Good to hear that it’s being worked on, or at least looked into.

And incidentally you answered my second question…I now know where to submit the feature request. :wink:

Thanks,
Ryan

Although submitting it won’t get you far, even if a few vote for it, I don’t see any realistic option for it to happen unless you source license unity and do the required (likely not small nor trivial) rewrites required to integrate MS .NET instead, dropping the webdeploy with it.

Unity uses mono internally for various things including the web plugin, there is no way to get around that.
Unity has tighly integrated mono, as such you can’t just replace it with something thats “not the same” (Mono 1.2.5 to mono 2 already shows that and thats both mono, not Mono ↔ MS .NET :wink: )

Yes, that was intentional…I have been accused of being concise before. :wink: I can’t see .net itself ever being used in Unity for primarily the reasons dreamora alludes to, but there’s no harm in asking.

–Eric