Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mono Upgrade Future plans for the Mono runtime upgrade

Discussion in 'Experimental Scripting Previews' started by JoshPeterson, Apr 3, 2017.

  1. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    We wanted to let everyone on the forum know our future plans for the Mono runtime upgrade.

    The Unity 2017.1 release will be available as a public beta soon. In this release, the Mono runtime upgrade feature will be an option. For a given project, you can choose to use the existing version of Mono in Unity (with .NET 3.5 support) or the new Mono runtime (with .NET 4.6 support). In Unity 2017.1, the default setting is to use the older version of Mono. Soon (maybe the 2017.2 release of Unity) we will make the new Mono runtime default, with the old runtime as an option. Later still, we will remove support for the old runtime. More details will be coming in a blog post soon, but we wanted to let everyone on this forum know first.

    We really appreciate the time, effort, and feedback so many of you have provided to move this process forward. Our team is focused on shipping the Mono runtime upgrade to all of the Unity users without breaking things. The work you have put in to find many of the things that did break is invaluable.

    At this point we are not planning to ship more experimental preview builds via this forum. Instead, we will move back into the standard Unity beta cycle. I know that our last preview build suffered from some unrelated bugs in the Unity beta version we used. I would encourage anyone who still wants to use the Mono runtime upgrade to try the 2017.1 beta when it is released. I suspect the bugs from the 5.6 beta we last used here will be corrected, but you'll find new and different bugs in the 2017.1 beta.
     
    Last edited: Apr 3, 2017
    User340, Hiovita, Mazyod and 24 others like this.
  2. cdarklock

    cdarklock

    Joined:
    Jan 3, 2016
    Posts:
    455
    This is actually really good news.

    What does that mean, for those of us who are relatively new here and don't know what the "standard" was?
     
    Cromfeli likes this.
  3. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    Unity ships beta releases about once per week. Any changes we have to correct issues with the Mono runtime upgrade will ship via those releases instead of via custom installs posted on this forum.
     
    Cromfeli and cdarklock like this.
  4. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Awesome news! Can't wait for it! :D
    Do you know what will happen to Mono.Evaluator? It's not part of the "normal" .NET framework, but since 4.6 will be supported...

    Also, did you guys come up with any new ideas regarding package management? Maybe have some sort of custom nu-get repository or something and a simple tool built-in in the editor?
     
    Qbit86 likes this.
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    I'm not specifically familiar with Mono.CSharp.Evaluator, but I don't see why it won't work.

    Another team at Unity is working on this, but I don't have details about how it will look or when it will be ready. It is not a part of the Mono runtime upgrade though.
     
    dadude123 likes this.
  6. Tor-Vestergaard

    Tor-Vestergaard

    Joined:
    Mar 20, 2013
    Posts:
    186
    This is great news! Does Unity implement a synchronization context for the async/await features this will bring, or will we have to do that ourselves?
     
  7. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Afaik that was asked a few months ago as well, and they said they'll provide a context (it would be complete anarchy if they didn't lol)
     
    Tor-Vestergaard likes this.
  8. tohlsen

    tohlsen

    Joined:
    Nov 10, 2016
    Posts:
    2
    Can you share the version of the Mono runtime being upgraded to?
    Does this version of the Mono runtime support .Net Standard?
    Can we expect more frequent upgrades to the Mono runtime going forward?
     
  9. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    276
    We are currently using a branch based off Mono 4.8.
    We will support netstandard 2.0 once it is finalized.
    Yes, we're intending to update as frequently as it makes sense given Mono and Unity release cycles.
     
  10. tohlsen

    tohlsen

    Joined:
    Nov 10, 2016
    Posts:
    2
  11. Zuntatos

    Zuntatos

    Joined:
    Nov 18, 2012
    Posts:
    612
    Does the upgraded runtime support 'common' .NET profilers? As in, the memory/garbage profilers, performance profilers. It's a pain that current Unity versions do not support these.
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    Unity does provide a synchronization context that brings code back to the main thread in Unity, where it is safe to use the Unity API.
     
    Mazyod and Tor-Vestergaard like this.
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    For the 2017.1 release, Unity will only support the full .NET 4.6 profile (at least initially, we could add more support later). We're not planning .Net Standard 1.0 through 1.6 support, because those profiles have a number of important things missing. It looks like 2.0 will replace them soon, with much wider support. So our focus is on .Net standard 2.0. We'll have more details in the announcement blog post that will be coming soon.
     
    Qbit86, dadude123 and Cromfeli like this.
  14. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    We're not adding any support beyond what Mono 4.8 has. So if tools work with Mono 4.8, they should work with Unity.
     
    Zuntatos likes this.
  15. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    What choice did you land on with regards to the elvis operator?
     
    Pharan and Qbit86 like this.
  16. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    We've made no changes for the elvis operator now. The behavior of classes derived from MonoBehaviour will be the same with respect to the "odd null handling" as it is with the old Mono runtime.
     
  17. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Sorry my wording wasn't clear. I meant:
    Will the updated version of the evaluator (that supports compiling classes, not just statements) be part of unity? (just like when I install mono manually from the mono website)

    Or in other words: Will all assemblies that are part of a normal mono installation be part of Unity as well? Or will some assemblies be left behind (in time) because of some incompatibilities?
     
  18. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    Yes, the full Mono 4.8 installation is included. For example, Unity does ship with Mono.CSharp.dll.
     
    dadude123 likes this.
  19. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
  20. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    Package management, netstandard, semantics of Elvis operator — what a lovely thread! Nice to know I'm not the only one who is interested in all these things.
     
    Pharan likes this.
  21. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    C# 6 is toooo old. What about C# 7?
     
  22. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    One step at a time. :) C# 7 support is coming in Unity, but not yet.
     
  23. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
  24. cdarklock

    cdarklock

    Joined:
    Jan 3, 2016
    Posts:
    455
    Is this why the nunit/TestRunner warnings pop in 5.6? Will that be disappearing "real soon now," so we can just ignore it for a couple weeks? ;)
     
  25. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    I'm not familiar with that warning. Can you provide more details (maybe in a different thread)? In general though Unity 5.6 is not involved in the Mono runtime upgrade at all, so it seems unrelated, but still something we want to understand.
     
  26. cdarklock

    cdarklock

    Joined:
    Jan 3, 2016
    Posts:
    455
  27. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    Thanks, I'll have a look at that thread. To clear up the confusion of about the version numbers though, the "2.0.0.0" in this assembly reference string is for .NET 2.0, which is the older .NET profile that Unity supports.

    .NET standard 2.0 is and entirely different profile, which is not yet finalized, nor support by Unity (but will be in the future).

    This is all a bit confusing to most everyone I've talked to.
     
  28. cdarklock

    cdarklock

    Joined:
    Jan 3, 2016
    Posts:
    455
    Yeah, I worked at Microsoft for years and still don't know what all the different version numbers on .NET actually mean.
     
    Spixy and Baste like this.
  29. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Glad this isn't a preview build again and will actually be part of 2017.1 beta releases ...can't wait :)
     
  30. Seto

    Seto

    Joined:
    Oct 10, 2010
    Posts:
    243
    Anyway, it's a good news. Looking forward to it.
    But we can't get start with it since it's not yet available and the preview build is with bug from 5.6.
     
  31. kiyakkoray

    kiyakkoray

    Joined:
    Jan 29, 2017
    Posts:
    8
    I'm not sure if this is related with .net upgrade stuff but i am wondering if you have any plans to replace vector structures with the ones inside System.Numerics?
     
  32. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    I agree and also created a thread time ago:

    https://forum.unity3d.com/threads/system-numerics.451073/
     
  33. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    Then why not to start with `netstandard1.6` which is already released? `netstandard2.0` will not be available until Q3 2017.
     
  34. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    We don't think that netstandard 1.6 will be very useful for most Unity users. It is missing many APIs that exist in the .NET 2.0 profile, so it would break a number of existing projects. The netstandard 2.0 profile is geared to addressing this, after feedback from us and many others.

    So rather than focus on the netstandard 1.6 profile, we put resources elsewhere and decided to wait for netstandard 2.0.
     
    katoun and Qbit86 like this.
  35. j-borden

    j-borden

    Joined:
    Mar 3, 2015
    Posts:
    21
    Just to weigh in here: This is great. I've been waiting for this for a good two years now. I tried unsuccessfully to support Unity3D for the library I develop at Couchbase that currently targets Mono, Microsoft, and Xamarin (It became an unmaintainable time sink due to my team size of 1 and the subtle but high number of differences between the behavior of Unity3D and the behavior of a modern Mono). This upgrade will allow me to give it a second shot and hopefully succeed this time. I'm also converging onto .NET Standard (so far 1.4, to get UWP support) so hopefully this will let me have another try!
     
  36. Deleted User

    Deleted User

    Guest

    Sorry if I've missed this somewhere, but are there plans to include this preview change in the Linux build of Unity? :)

    This would be helpful as I am currently playing around with Unity on Linux and I would like to try the MemoryCache and Concurrent features that come with .NET 4.0.
     
  37. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    I'm not sure about the release schedule for the Linux editor, but when there is a beta release of it with 2017.1, it will have the option to try the experimental runtime, as with the editor on Windows and macOS.
     
    Deleted User likes this.
  38. Deleted User

    Deleted User

    Guest

    Sounds perfect! :) Thanks for the speedy response!
     
  39. Vytek

    Vytek

    Joined:
    Apr 29, 2016
    Posts:
    51
    Qbit86 likes this.
  40. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    Astarorr and Vytek like this.
  41. Genom

    Genom

    Joined:
    Dec 2, 2014
    Posts:
    86
    Hi Josh, is the webgl bug already fixed in this release?

    thanks!
     
  42. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    @Genom

    No, we still don't support WebGL. Some things will work in WebGL, but there are known issues in the .NET 4.6 class library code which make it incompatible with WebGL. We are working on correcting those, but they are not finished in 2017.1b1.
     
  43. cureos

    cureos

    Joined:
    Apr 19, 2016
    Posts:
    9
    Hi Josh,

    If I want to build a new class library e.g. with Visual Studio for the new 2017.1 beta, can I now target base class libraries for Mono 4.6, and in that case, how do I do that? I still only see the various .NET 3.5 base class libraries for Unity.

    Thanks in advance,
    Anders @ Cureos
     
  44. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    @cureos

    Make sure you have Visual Studio Tools for Unity version 3.1 installed. That will set up the assembly references in the .csproj files that Unity generates correctly. Without VSTU, Unity is generating the .csproj files for .NET 3.5 still. We will correct that issue.
     
    cureos likes this.
  45. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    well that explains a few errors for me then....does the 2017.1 not install the 3.1 version of vstu, as my one is 3.0.0.1 on vs2017, also where is vstu 2017? only see 2015 even though seems to work on vs2017
     
  46. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    @Player7

    I think that VSTU 3.1 was just released. I should support VS 2017 as well as the new Mono runtime and .NET 4.6 in Unity 2017.1b1. It might be the case that the Unity installer is not grabbing the latest version of VSTU, although I believe it should be. Our QA is checking on this now. But you can manually update VSTU.
     
  47. cureos

    cureos

    Joined:
    Apr 19, 2016
    Posts:
    9
    Thanks for the prompt response, Josh. However, when I try to create a new class library in VS 2015 after having installed VSTU 3.1 it still only lists "Unity 3.5 .net full Base Class Libraries" etc in the "Target Framework" drop-down list. Is Mono 4.6 implicitly targeted, or is there something else I am missing?
     
  48. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    Unity 2017.1.0b1 does not work with classes from .NET 4.6, when scripting runtime is “Experimental (.NET 4.6 Equivalent)”.

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. namespace LazyTask
    4. {
    5.     internal sealed class Main : MonoBehaviour
    6.     {
    7.         // error CS0433: The imported type `System.Lazy<T>' is defined multiple times
    8.         private readonly System.Lazy<string> _lazy = new System.Lazy<string>(() => "Hello");
    9.         // error CS0234: The type or namespace name `Tasks' does not exist in the namespace `System.Threading'. Are you missing an assembly reference?
    10.         private readonly System.Threading.Tasks.Task<string> _task = System.Threading.Tasks.Task.FromResult("World");
    11.  
    12.         private void OnGUI()
    13.         {
    14.             if (GUILayout.Button("Test"))
    15.             {
    16.                 Debug.Log(_lazy.Value);
    17.                 Debug.Log(_task.Result);
    18.             }
    19.         }
    20.     }
    21. }
    There is also an undesired reference to `nunit.framework.dll` in generated csproj, which also defines `System.Lazy<T>`.
     
  49. npatch

    npatch

    Joined:
    Jun 26, 2015
    Posts:
    247
    Will we be able to use async tasks in the Editor and be able to avoid weird designs around Update funcs registered to EditorApp.Update?
     
  50. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Well I dunno, I did just go download and install vstu 2015 3.1.0.0 but inside vs2017 vstu version in the extension manager shows as 3.0.0.1..maybe its working I'll check again later with the net4.6 project I was testing before on unity2017.1 where it seemed to only being see net3.5