Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 5 and Mono Runtime

Discussion in 'General Discussion' started by Deleted User, Mar 19, 2014.

  1. Deleted User

    Deleted User

    Guest

    Hi everybody,
    I watched a video about the new version of Unity, and really looking forward to its release.
    And one thing that makes me sad is that there is no information about Mono Runtime update.
    I know that upgrade to latest Mono runtime is not that easy due to licensing issues =/
    But Unity still uses the old version of Mono 2.x, which has terrible GC, a lot of bugs and performance problems. Current version of Mono 3.x made great progress but it seems to be Unity will work on this...let's say old junk.

    So, i'd like to hear your opinion on this..and preferably an official comment:)
    P.S. I'm sorry, I did not notice that there is another post about it.
     
    Last edited by a moderator: Mar 19, 2014
  2. Deleted User

    Deleted User

    Guest

    n
    Yes everyone is going flappy birds on the situation, between me you and a rather delicious looking lamp post. A birdy (Figure it out for yourself) let drop a secret about removing mono completely. Because let's face it, nobody wants mono it's a horrible affliction.

    P.S Unity people, be careful what you post on that bird resemblance place . There are people who look at it, when their very very very, very bored...
     
  3. cynic

    cynic

    Joined:
    May 21, 2013
    Posts:
    142
    Yea well, the last official comment on this is pretty much that they -are- working on it. Whatever that might actually mean for the future. :p

    Hahaha.:D
     
  4. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Interesting if they are using asm.js which is currently setup for C/C++ to javascript compilation, what are they doing about Mono?

    They could write a converter but then they are back to the problem of trying to drag everything and the kitchen sink in Mono / .Net into javascript. Which is technically challenging but could also produce more licensing problems?

    Remember the issues they had with Flash, some features were compatible between languages but some are not and would throw out lots of errors from the actionscript compilation process.
     
  5. Deleted User

    Deleted User

    Guest

    So from the birdy in the sky, (Also mentioned at GDC) so if anyone was there they'll know the same anyway. Unity are supposed to have a .Net to C++ converter in the works.. Which makes perfect sense really, you have Xcode for Mac deployments, GNU compiler stack wrapper / C++ for PS4, windows is obvious etc. etc. (I only dev for them so I don't know the rest :D).

    Well spank my buttocks and call me charlie, GC may be a thing of the past.. Also they can take that money and spend it on some terrain UPP-GR-AA-YY-EE-DD-S?

    You have to admit, one reason why CryTek made a killing was due to everything being proprietary pretty much. So it's not a bad idea for Unity to take the core in that direction.. Then again, it's not a bad idea to have tea and biscuits which is next on my list to do.
     
    Last edited by a moderator: Mar 19, 2014
  6. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    So, yes, as ShadowK has been hinting at, we have built a new technology to take .NET bytecode and emit corresponding C++ code over the past two years. This lets us get your code to JavaScript + asm.js by then compiling the emitted C++ code using emscripten. All of this is transparently part of the build process. While we don't expect 100% code compatibility, we are already in a state which is much better then what our Flash code converter could ever do. It will always be restricted to AOT compilation, however (similar to iOS), so anything which requires dynamic code features in .NET will not work.
     
  7. Nasarius

    Nasarius

    Joined:
    Oct 1, 2012
    Posts:
    17
    Yeah, so even if this all works out well, we're still mostly stuck with .NET 2.0 and no compatibility with a lot of third-party libraries.

    Which is absolutely fine if you're considering that .NET will become a legacy or supplementary solution for Unity, and that writing C++ code directly is the preferred solution for performance. I'd be perfectly happy with that. Just give Pro users a C++ API and I won't particularly care about Mono anymore.
     
  8. Deleted User

    Deleted User

    Guest

    Well were stuck with a god old version now anyway, might as well remove the garbage collection from the equation..
     
  9. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    In 5.0 this Technology will only be used for WebGL. We are aware that it has more potential then that and you may see it on other platforms at some later point, but we have no specific roadmap for that yet.
     
  10. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    It is true that some .NET features and some third-party libraries won't work with AOT. That is the same as using AOT platforms (like iOS) in mono, really (even if we used the latest mono). How does the AOT approach limit you to .NET 2.0, though?
     
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    But also secures the source code better - so people who release demo assets or their games, do not have red gate pull it all apart again? If this is something that would work on any target platform it would be fantastic.

    Even more fantastic? The ability to directly inject your own C++ right there in the editor. Perhaps with a compiler directive. Attract the world's C++ programmers because even though I wouldn't - I'm sure many would.
     
  12. JonathanBolten

    JonathanBolten

    Joined:
    Dec 15, 2012
    Posts:
    50
    I'm probably in a minority camp, but I actually ENJOY programming in C++ more than C#. There's too much hand holding, and garbage collectors are so annoying.

    I know C# is too big of a selling point for Unity to ever remove, but I can always dream about the addition of more direct C++ support. :)
     
  13. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Indeed, seems senseless not to now things are vaguely moving in this direction. Long term, Unity needs to be self sufficient.
     
  14. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    It opens the way to potentially bypass mono on every platform, allowing for compiled build targets. While still allowing developers to script in C# and the possibility of adding C++ in the future.

    Nice one UT ;)
     
  15. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    276
    Just to be clear, the generated C++ still executes in a 'virtual' environment (our own equivalent of the mono runtime). It's just that C++ source is produced from the IL and compiled with a C++ compiler to produce the native code, rather than using the mono JIT or AOT compiler.

    A GC is used to managed memory, as the source IL doesn't contain enough information to manage memory like traditional C++ development. For example, cycles are allowed and a GC is the only mechanism to handle something like this.
     
  16. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Does this mean C# will go away in Unity? I'm hoping I'm reading too much into all this, cause after 20 years of C++, I'm sick of it.

    Gigi
     
  17. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    276
    This technology is used to support WebGL and it is completely transparent to the user. You write everything like normal in your choice of C#, UnityScript, etc and everything is converted at build time. It is analogous to current AOT platforms like iOS where .Net assemblies get converted into native binaries.
     
  18. Nasarius

    Nasarius

    Joined:
    Oct 1, 2012
    Posts:
    17
    Sorry, I meant .NET 3.5 and C# 3.0, which is before the "dynamic" type. I'm just saying that it doesn't really offer a path forwards from the status quo of Mono 2.6.5.

    Really there are two possible ways to take this news: either that we're truly stuck with nothing but Mono 2.6 and this is just a workaround for WebGL, or that you're actually working on long-term alternatives. UT doesn't seem to be willing to comment on this at all.
     
  19. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    It seems more likely that at the current stage, they don't know if it will ultimately be used for anything beyond WebGL. On paper it sounds like it has a lot of potential, but I kind of agree that they wouldn't want to commit to any of those potential avenues unless they were sure they were moving in that direction.
     
  20. Marionette

    Marionette

    Joined:
    Feb 3, 2013
    Posts:
    349
    one of the main reasons that unity attracted me was that i, and others, could leverage their existing C# knowledge, as well as those learning C# to use with unity could also leverage some basic knowledge in the real world.

    i came up through C++ and i hated it the entire time. i spent more time screwing around with includes, and strings, and unicode vs widechar/_MCBS and just general 'cobbleware' and the multitude of compilers.. what a complete pain in the a**...

    don't even get me started on ATL/COM/IDL, reference counting etc etc.. folks not understanding the basic differences between releasing and deleting etc.. wacked out string libraries, and home grown smart pointer implementations..

    all of that frustrating crap went away when C# came on the scene. true, there were trade offs, multiple inheritance, templates, macros etc but i could focus on what the code is supposed to do.

    for example: take 2 developers. 1 using C++ and 1 using C#. have them create the same type of project and let them at it. which do you think will get to be able to compile something useful faster?

    when i found unity used it as a scripting language, i was ecstatic since it made complete sense to me. even using mono made sense. what doesn't make sense is using a version of mono that completely gets in the way of the language it's supposed to be supporting. compounding that with a new converter to C++ makes even less sense to me since now, you'll have to implement (new, as .net improves) language specific features into the converter, or more worryingly, NOT implementing them. which means, we're kind of back at where we started, right?

    for those that don't know it, but even with a converter to C++ there will ALWAYS be some sort of memory management, whether it's language dependent (ATL/COM reference counting) or some version of homegrown, you will always have to rely on that as a 'GC'.. unless of course you guys are going to let us choose to create/allocate things in the heap/stack ourselves? and then relying on us to release/delete them properly ourselves? and if that was the case, why not have just gone to LUA or C++ from the beginning?

    my opinion is that UT *gained* a ton of folks by using .net/mono. C# is relatively easy to learn to use. especially vs C++ or even LUA.

    one of the main things i dig about this engine is that i have some relative power to code things backed up by .net...

    sorry to be negative, but i think this is only going to shed you of a lot of your user base..
     
    Last edited: Mar 19, 2014
  21. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    276
    What is going to shed a lot of the user base? Nothing has changed from the users perspective as far as I can see.
     
  22. Marionette

    Marionette

    Joined:
    Feb 3, 2013
    Posts:
    349
    there are already things in the .net 4.0+ that we can't even think of using that we'd like to. things that we're waiting for you guys to either implement or update your lic with xamarin as they have already updated things.

    the issue i'm concerned about is that if you write a converter, for us to get new functionality, you guys are going to have to *specifically* implement that, right? the thing is, a lot of us out here hold out hope that a deal with xamarin can be worked out, or even that you guys with your branch, will implement the major missing bits that we'd like to use that are available in .net right now and have been.
     
  23. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Happy camper == Me!
    Gigi
     
  24. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    276
    At this point, the only change from the status quo is that a tool now exists which converts IL into C++ to allow scripting to function in WebGL. Anything beyond that is just speculation.

    We know the current situation with the mono version we ship is problematic and are looking at how best to address that situation.
     
  25. Marionette

    Marionette

    Joined:
    Feb 3, 2013
    Posts:
    349
    understood. and i'm not trying to be a jerk, just trying to express how important this is to not only myself, but others.
     
  26. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    862
    I cannot believe what I am hearing. Mono has millions of developer hours and decade of work completed. The idea that you can every try to replicate that is ludicrous.

    I have 100s of thousands of lines of code in c# that has already been debugged. Almost 5 years of work. I already paid my $600.00 for unity 5.0 I am locked simple because of legacy code. Update mono already.

    This will be a sucky ass solution. Going to .net would be fine even if you could only release on xBox and PC.
     
  27. cynic

    cynic

    Joined:
    May 21, 2013
    Posts:
    142
    I believe it was Graham saying something along the lines of "we're working on it" in the Unity 5.0 announcement thread. Now I'm wondering whether this converter of yours is what he meant by saying that. Judging from your statements there is still no solution to the Mono situation on the horizon, other than that you're "thinking" about it. Is that more or less accurate?
     
  28. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    This technology is the best chance for Unity to keep Mono and upgrade for a reasonable price and all that with a contract that has clauses for future updates. They can now demonstrate Xamarin that they don't rely on Mono and that there is another solution. This gives Unity a strong position for a good contract. And in the case that Xamarin doesn't agree, Unity can broadly use the new technology and make Mono obsolete in Unity. Unity could even decide to become a direct competitor by providing a highly optimized .Net to native code solution. I doubt that Xamarin is interested in that kind of competition.

    Edit: With "technology" I mean the IL to C++ compilation and everything it takes to executed the .Net code natively.
     
    Last edited: Mar 23, 2014
  29. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    Using this technology is it likely that C++ would be added? If the code is compiled from bytecode to C++ surely you could easily add C++ then just have it added after the bytecode compilation?
     
  30. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    Unusually rampant speculation-like musings: I imagine that if you can reliably get our code to C++ that you'd have more options from there as to what to do with it. The fact that you're currently planning to use that in a VM doesn't mean that will be the only way it can ever be used... (Though I do understand that there are implications since it comes from bytecode.)
     
  31. Smooth-P

    Smooth-P

    Joined:
    Sep 15, 2012
    Posts:
    214
    I just puked in my mouth, and it wasn't a rainbow... UT's grand idea for the future and what you've been spending time and money on is triple compiling code and moving FURTHER into AOT restrictions? Should I just sign up for my lobotomy now?
     
    vexe likes this.
  32. GCatz

    GCatz

    Joined:
    Jul 31, 2012
    Posts:
    282
    Well said.
     
  33. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    What kind of restrictions do you mean? There are a few regarding genericity and everything else I am aware of should not be used anyway.
     
  34. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    What is the GC you're using? Is this an in-house GC that you guys wrote yourself? Is it generational?

    Also, mark me down as one of the "this actually sucks and I don't want it at all" group. It's fine as a tool to temporarily wedge stripped down C# code into something WebGL can handle. It's not a solution for actual .NET development going forward.

    You guys have been "looking into it" for five or six years now. It's time to stop looking and actually do something about it.
     
  35. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    They have done their job. Besides upgrading Mono, they may also enhance their implementation for WebGL, such that it becomes the default in Unity.
     
  36. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    No offense to Unity, I know they've got some smart devs, but I have absolutely zero faith that they've somehow figured out a "highly optimized .NET to native code solution" when no one else in the industry including Microsoft or Mono have figured out how to do it. Especially since they haven't yet demonstrated they can do a "not completely terribly optimized modification of Mono" in the decade since it came out. To me this sounds like a buggy SWIG-based beta parser that will turn simple .NET 2.0 AOT compatible code into possibly-working-but-maybe-not C++ that then runs through a home made non-native interpereter that is probably slower than a normal .NET JIT and is built on a tacked on and untested garbage collector.
     
    vexe likes this.
  37. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    What? They haven't upgraded Mono. That's the point of the thread. Also I sure as hell don't want WebGL to be any kind of default. If they stop supporting platform-based builds and expect us to run everything through Chrome I would drop Unity like a hot potato.
     
  38. cynic

    cynic

    Joined:
    May 21, 2013
    Posts:
    142
    Except that they didn't upgrade Mono and didn't hint at actually upgrading Mono in the near future, unless I just missed something.
     
  39. cynic

    cynic

    Joined:
    May 21, 2013
    Posts:
    142
    Ditto.
     
  40. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    We most likely have that situation due to licensing reasons.

     
  41. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Yes, it's absolutely because of licensing reasons; they have pretty much flat out stated that the reason they won't update Mono is because Xamarin is demanding a ton of money to let them do it, and Unity is trying to play chicken by showing Xamarin that Unity users are just fine with using the Mono version from 10 years ago and that the upgrade isn't really worth that much money. To me, it's long past time to give up the charade. Xamarin clearly has called Unity's bluff, and as time goes on and Unity's Mono keeps getting more and more out of date, Xamarin is going to just keep raising the price. Sometimes you have to know when to fold.
     
  42. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    ~Well the only problem I have with older mono is that GC needs a good tweak. That's just about my only problem. If Xamarin want to get funny over one single static link, then that's their problem and their loss. I'm sure there's nice people working there and all, and this is all just legalese silliness though.
     
  43. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
    You know what? Calling bullshit on "licensing reasons" being a valid excuse. Unity's version of Mono has never been terribly up to date, with the version we have now coming up on five years old. The new generational GC, which has shown substantial improvements over the old one, was introduced four years ago. Unity even kinda has trouble updating its own built-in things, such as the absolutely antiquated terrain engine. Unity also has a tendency to license new things all the time and then implement them halfway, so I kinda have to doubt this is a straight money thing at this point.
     
  44. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Or my other solution, if the bad blood between Unity and Xamarin has progressed to the point where they refuse to pay. First, do NOT go the way of trying to drop .NET and switch to C++ this late in the game. Don't try to invent an in-house.NET to C++ converter for all platforms. If you've got one for WebGL then that's fine. In my opinion, Unity should clean up the Mono bindings, refactor their code to expose all the points that touch Mono, and use an IoC wrapper or something to allow dropping in an interpreter. Then they could write an interpreter wrapper for MS .NET and Mono, and we the users could download whatever version of Mono or MS .NET we want, thereby removing Unity's need to actually license anything from the equation. The only problem then would be needing to statically link the interpreter for iOS builds, and for that they can just keep the crappy current Mono build that they own. iOS deployments would have to deal with it, but the other platforms would be fine. Maybe it would get iOS users to complain enough that they could convince the Apple Store that they need to support dynamic linking in order to keep up with the other phones.
     
  45. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Which bluff? Your so called bluff seems to work quite well already.
     
  46. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    If Microsoft buys Xamarin, one has to wonder how this will affect the licensing to Unity.
    Microsoft and Unity are pretty tight at the moment.
     
  47. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    My take on this is that if Unity keeps growing, Xamarin will grow alongside Unity (as Unity is really dependent of mono right now) and the more it grows the harder it'll be for Unity to get a new mono license.
    Solution: keep supporting your current version of mono but build your own independent C++ API. This will cut Xamarin wings (which have been a bit arrogant with their license terms lately). Believe me, if Unity haven't been unable to get a new deal with Xamarin it really means Xamarin either want a really huge pie chunk or simply doesn't give a sh*t about Unity. For me sticking with C++ and a GC provided by Unity would be a good starting point and probably better than the outdated version of mono which is leading nowhere seriously. At this point I don't think you'll ever get any new license of mono, you all can start forgetting about any new .net frameworks!
    PS: Please take notes on UE4 C++ API, it offers both flexibility and power while being very elegant and clean.
     
  48. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Totally agree!
    Keeping using mono will just make things worse in the future. Becoming independant of Mono is the only way to go!
     
  49. Smooth-P

    Smooth-P

    Joined:
    Sep 15, 2012
    Posts:
    214
    Exactly. I can't believe there are people in this thread who think UT implementing their own VM is in any way a good thing. The Mono we have now was developed by a team whose entire purpose was to create a .Net compatible VM and it still has tons of issues... Do you really want to trust your VM layer and the features it supports to a company who puts so little effort into doing things right for professional programmers that they didn't even properly support something as fundamental as NAMESPACES until recently?

    Even if the VM team is somehow composed of hires that are 100x more competent than the fine designers who brought us APIs like Shuriken, do we trust management to give them the time and resources to do things right? Or will it be like physics, terrain, (non)-nested prefabs, and everything else half-assed about Unity?
     
    Last edited: Mar 23, 2014
    vexe and lordofduct like this.
  50. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    I don't agree, because with their IL to C++ compilation, they are already pretty far in the direction of becoming independent of Mono. The C# to IL compilation can be handled with Xamarin's C# compiler because it is MIT licensed. The last piece of the puzzle is the runtime environment including the GC. For the beginning it would be sufficient to work with what they have and step by step improve it. Yes, that's anything but trivial to implement.
    That approach has the benefit, that we wouldn't loose all our code.