Search Unity

[FREE TRIAL] Unity C# 6.0 Compiler

Discussion in 'Assets and Asset Store' started by ilya_ca, Mar 30, 2015.

Thread Status:
Not open for further replies.
  1. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    NO LONGER A SUPPORTED PRODUCT




    edited by moderators.



    We believe that Unity developers deserve to have access to the newest development tools. That's why our team worked hard on integrating the newest Microsoft Roslyn compiler into Unity.

    C# 6.0
    brings developers many new and exciting features. Another added benefit is improved compilation time provided by the newest C# compiler.

    This tool works by redirecting compilation requests from within Unity to the newest Microsoft Roslyn compiler. Compiled code is compatible with .NET 3.5 and is guaranteed to work on most platforms.


    Supported deployment platforms:
    Windows, Mac, Android, iOS. Webplayer is currently not supported. Other platforms may be supported, but weren't yet tested.

    Although produced binaries will run on the above mentioned platforms, current version of this tool works only on Windows. C# 6.0 code won't currently compile on Mac OS.


    Supported new language features:

    String interpolation:

    Code (CSharp):
    1. $"GameObject name: {gameObject.name}"
    Expression-bodied members:

    Code (CSharp):
    1. public string FullName => $"{FirstName} {LastName}"
    Default values of auto properties:

    Code (CSharp):
    1. public string FirstName {get; set;} = "John"
    Null-conditional ?. operator:
    Partially supported, currently not supported with components inherited from Object as it overrides the equality (==) operator. Regular C# types are supported.

    Code (CSharp):
    1. material?.Shader?.Name?.Length
    Using static classes:
    Code (CSharp):
    1. using static Math;
    2. ...
    3. float sin90 = Sin(90f);
    nameof expressions:

    Code (CSharp):
    1. Debug.Log($"name of variable is {nameof(someVar)}")
    Dictionary initializers

    Code (CSharp):
    1. public Dictionary<string, string> CountriesList = new Dictionary<string, string>
    2.                              {
    3.                                ["ca"] = "Canada",
    4.                                ["us"] = "United States",
    5.                                ["uk"] = "United Kingdom",
    6.                                ["ch"] = "China"
    7.                              };
    8.  

    Features not supported:
    Async/Await
    Dynamic data types


    Current version is 1.07 (released on April 10th 2015):
    • Improved logging
    • Fixed concurrency issues
    • Fixed uninstallation bug
    • Fixed missing debug information bug

    The tool can be purchased at: http://www.unityninjas.com/downloads/unity-c-6-0-compiler/
    The price is $25.


    A free fully-featured 30-day trial is now available at: http://bit.ly/CS6TRIAL


    Please send bug reports to goldenzebrasoftware@gmail.com instead of posting them in this thread. This will help us to fix the bug faster, and will make the forum thread easier to read. Thank you!

     
    Last edited by a moderator: Sep 14, 2015
    Arkade, jpthek9, Ghosthowl and 11 others like this.
  2. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    I'll answer a few questions about the tool:

    We're using Microsoft Roslyn compiler, and it runs independently from Unity (it's a standalone application). It's not bound to Unity's Mono platform. Roslyn is capable of producing .NET 3.5 code.

    It's possible to use C# 6.0 in Unity, because language version is mainly independent from the runtime version. Almost all features of C# 6.0 are supported, except for Caller Information.

    Mono MCS compiler doesn't yet support all of C# 6 features, that's why Roslyn is used in our tool.

    Resharper support - we use Resharper for all of our development in-house. It works flawlessly with C# 6.0, we haven't yet encountered any issues. The compiler tool has also been extensively tested, and is able to compile huge codebases without any issues.

    The tool doesn't interfere with the compilation process in any way. It simply redirects compilation requests from Unity to Roslyn, and adds a few command line arguments to target .NET 3.5.
     
  3. Fubeca

    Fubeca

    Joined:
    Jul 21, 2013
    Posts:
    41
    Can you give us a preview of the price? :)
     
  4. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Missing ETA and price. :D
     
  5. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    this looks quiet interesting. Any link for the assets store?
     
  6. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    Thank you! This is awesome. Is Mac support planned for the (near) future?
     
  7. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    I'm also wondering about Mac support.
     
  8. Rico21745

    Rico21745

    Joined:
    Apr 25, 2012
    Posts:
    409
    Thanks for the codes, claimed one. I'll be happy if it eventually gets async and await support since those are some my most used newer .net features not available in 3.5
     
  9. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    Cool, very interesting to see it in action. :)
     
  10. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    Last edited: Apr 24, 2015
    JasonBricco likes this.
  11. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I saw your post in the other thread discussing C# 6. I just used a code to download it and see how it goes!
     
  12. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    sweet and thanks for the free key that i can use to play with... :)

    if its checks out i'll be happy to buy a key when it hits the unity asset store!

    cheers!
     
    Last edited: Apr 3, 2015
  13. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I'm very impressed! Yesterday it worked flawlessly all day; though I have hit a bug this morning. Unity crashed saying that mono.exe had crashed, now any time I open my project I get this error:

    (Edit: This bug was later fixed)

    I tried deleting that settings.xml file and it recreated it but it still gets the error. It also seems that while I have this error, it is unable to compile my Plugins and Plugins/Editor projects, so the assets in those folders aren't working.

    I tried uninstalling the compiler in order to reinstall, but the uninstall fails with this error:
    Though, looking in my Unity folder, smcs.orig.exe is actually there, so I'm not sure why it can't find it. Reinstalling without uninstalling didn't fix anything.

    Edit: Some more info - I tried importing into a different Unity project and it worked fine, so something became corrupted in this project. I tried deleting the entire Library folder and rebuilding it but that didn't fix it. I'm guessing that that error message about being unable to access the settings.xml is actually a false error, since other projects can access that file fine, and the file does get recerated if I delete it. I think what's actually happening is that it's crashing when trying to build the CSharp.Plugins.Editor project, because the log shows that it builds CSharp.FirstPass and CSharp but then stops. I don't know what would have suddenly corrupted it because I haven't changed anything in the Plugins folder all day and it just crashed suddenly while I was working on a cs file in the regular CSharp project.

    Edit: One last edit. I was right and it was the Plugins/Editor project failing to compile. Finally fixed it by temporarily removing the Plugins/Editor and StandardAssets/Editor folders. That caused it to wake up and finally try compiling again, getting errors of course that the editor files were missing. Then I copied the Plugins/Editor and Standard Assets/Editor folders back in, and this time it recompiled with no error. Very strange.
     
    Last edited: Apr 12, 2015
  14. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    The error above happened twice more, and with the same solution... the Plugins/Editor project would not compile until I removed all the Plugins/Editor folders, let it recompile, and then moved them all back in again.

    One other thing I noticed that there may not be a way to fix: null propagation doesn't work with Unity components or MonoBehaviours. This is because Unity actually overloads the == operator on all components so that when you do (something == null) it actually checks to see if it's been assigned in the editor instead, since the values are never actually null. Apparently null propagation checks for null some other way, so it will just throw a "You must assign this value in the editor" exception when the component is null (or fake-null as it may be). Example:

    Code (csharp):
    1. public class SomeClass : MonoBehaviour {
    2.     public MeshRenderer foo;
    3.  
    4.     public void Start() {
    5.         foo?.DoSomething();  //throws exception if foo is "null", not assigned in the editor
    6.     }
    7. }
     
  15. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
  16. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    The Sharing violation error is happening a whole lot, on both settings.xml and the log file. I figured out I can fix it by just forcing it to recompile a bunch of times by changing files, but it's suuuuper annoying. I changed my mind about it being specifically related to Plugins/Editor and I think rather it's just related to how long it takes to compile everything. I'm guessing maybe you guys are trying to read/write to the settings and log files from multiple threads at the same time? That's a bad idea. ;)
     
  17. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    It seems I no longer get file names and line numbers reported in stack traces (in the Console window). To get some debugging done, I tried to uninstall the CS6 plugin and ran into the same "Compiler backup not found" error that makeshiftwings had, even though the file was indeed there. I manually restored the backup smcs and gmcs files and everything seems to be back to normal.

    So, bug report:
    1. Stack traces are missing from console log, presumably because debug information is missing?
    2. Uninstall of CS6 plugin fails with Exception: System.InvalidProgramException: Compiler backup not found at path 'Editor\Data\Mono\lib\mono\unity\smcs.orig.exe'
    I'm running with Unity 5.0.1f1 and Visual Studio 2015 Tools for Unity 1.9.8.0 on Windows 7 x64.

    [ EDIT: Bugs are fixed now. ]
     
    Last edited: Apr 10, 2015
  18. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    All of the mentioned bugs have been fixed. Send me a PM/email to get the newest version (1.06).
     
  19. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    I can confirm all my issues were fixed with the v1.07 update. Thanks!
     
    Last edited: Apr 13, 2015
  20. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    The locked file bug seems to be fixed with the newest update. Thank you!
     
  21. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    On your website, NOT supported?!

    Supported deployment platforms:
    Windows, Mac, Android, iOS. Webplayer is currently not supported. Other platforms may be supported, but weren’t yet tested.
     
  22. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    I don't quite understand your question, what exactly are you trying to say?
     
  23. Seneral

    Seneral

    Joined:
    Jun 2, 2014
    Posts:
    1,206
    Do we can target higher .NET versions now? Probably not, if you could hack that in a similar way it would be very much appreciated;) Anyways, this is really powerful. And for a reasonable price:)
     
  24. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    No, unfortunately we're still bound by .net 3.5. Targetting higher .net versions would require integrating a newer mono runtime into Unity, which is not easy.
     
    Seneral likes this.
  25. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Read the sentence on your website. It is NOT supported. Did I read wrongly?

    Windows, Mac, Android, iOS. Webplayer is currently not supported.
     
  26. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    I don't understand the point you want to make either. "Webplayer is currently not supported", what's wrong with that?
     
  27. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Those are two separate sentences.
    Windows, Mac, Android and iOS are supported.
    Web player is not supported.
     
  28. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    It looks like it should be possible to have support for Async/Await in Unity using AsyncBridge project.

    I'll see if we can add seamless support for Async/Await into the Unity C# 6.0 Compiler.
     
    Last edited: May 15, 2015
  29. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    227
    That would be awesome!
     
  30. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Let me know when C# code can compile on a Mac. I use Mac and would love this tool.
     
  31. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    Mac support should be coming in an upcoming version, stay tuned!
     
    JasonBricco likes this.
  32. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
  33. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    32
    Sounds great, but is it compatible with UnityVS?
     
  34. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    Yes, fully compatible.
     
    seffles likes this.
  35. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    32
    Excellent, then count me in. :)
     
  36. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Does this work in Unity 5.1+? I get some errors about UNetWeaver being unable to generate code from the Microsoft dll's:

     
  37. ilya_ca

    ilya_ca

    Joined:
    Nov 19, 2011
    Posts:
    274
    Sorry, this project is no longer supported. I have no further motivation to continue development after alexzzzz released a free version with similar functionality.
     
  38. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    You should continue to support your existing customers of they have paid for the product.

    Also, find a way to set yourself apart. There are plenty of json serializers and even free ones but it doesn't stop people from buying mine with one big reason I hear all of the time..
    support.
     
    ksummerk and sz-Bit-Barons like this.
  39. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Ah, that's fine, I was one of the people who got a code to download a free copy so I didn't spend any actual money. I'll try alexz's version and see if it has the same problem. I don't really know what Unity 5.1's doing compiling UNet code; i haven't got around to really looking at UNet yet.
     
  40. 31

    31

    Joined:
    Sep 3, 2012
    Posts:
    2
    Well now I feel dumb... I stumbled here searching for C# 6.0 in Unity, tried it out to my satisfaction, and sent an email asking if Linux is supported. Receiving a reply basically saying "I don't see why not" I bought the tool, and finally scrolled down in this thread to see that it's not supported anymore. It was only $25, but I still feel cheated. I can understand feeling frustrated that a free tool took out something that you were (are!) making money off of, but not making this clear on your website looks very scummy.

    I haven't tried alexzzzz's tool yet, but judging by the thread I read through I saw that CompilerServices might even be available, which is actually what I originally wanted. All's well that ends well?


    Edit: Got a refund
     
    Last edited by a moderator: Sep 15, 2015
    Ostwind and Dustin-Horne like this.
  41. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Locked then.

    You might want to remove from your signature. In the interests of fairness I edited your original post to clarify you aren't interested in fixing or supporting anything.
     
    twobob and EliasMasche like this.
Thread Status:
Not open for further replies.