Search Unity

We’ve been hard at work improving the updated scripting runtime since our last update. Unity 2018.2 ships with dozens of bug fixes related to the scripting runtime, thanks to all of the great feedback we have received since the .NET 4.x Equivalent scripting runtime became officially supported in Unity 2018.1. We’ve also added a number of features, available only with the .NET 4.x Equivalent scripting runtime, which make switching your project even easier.

Managed code debugging with IL2CPP

Unity 2018.2 brings managed code debugging to the IL2CPP scripting backend, with all of the same features as the Mono scripting backend. Just enable the Script Debugging option in the Build Settings for your IL2CPP builds, deploy the Unity player, and debug with great tools like Visual Studio (and all other debuggers which work with Unity).

The debugger attaches to the Unity player running on the device for IL2CPP just as it does for Mono. So remote debugging of a player running IL2CPP is available.

Debugging works with all IL2CPP platforms (Xbox One support will be available in 2018.2.2f1).

Modern SSL/TLS support in .NET

The .NET 4.x Equivalent scripting runtime brings full TLS 1.2 support to all of the .NET class library APIs, on all Unity platforms with Mono and IL2CPP. Unity will now work properly with the operating system to access the local certificate store and make secure socket and HTTPS connections work as you would expect.

Optimizing build size

The API Compatibility Levels available with the .NET 4.x Equivalent scripting runtime bring lots of great .NET APIs Unity developers have wanted for some time. They also bring more code from the .NET class libraries, which can increase the build size. We’ve focused the 2018.2 and (upcoming) 2018.3 releases of Unity on making the build size as small as possible for the .NET 4.x Equivalent scripting runtime.

Our internal tests indicate that Unity 2018.2 ships with a build size increase of less than 2% for a number of real-world projects that switched from the old scripting runtime to the new scripting runtime. In 2018.3 we’ll be delivering more improvements, including new features to allow even more aggressive managed bytecode stripping options, so stay tuned.

The future of .NET is bright

These are a few of the improvements we’ve been able to make with the .NET 4.x Equivalent scripting runtime to make the lives of Unity developers just a little bit easier. The 2018.3 release of Unity will bring even more improvements, as we continue our mission to democratize game development.

Unity 2018.3 will make the .NET 4.x Equivalent scripting runtime the default option for new Unity projects and will deprecate the .NET 3.5 Equivalent scripting runtime. Look for the .NET 3.5 Equivalent scripting runtime to be removed from Unity in the 2019 release series.

If you haven’t tried your project with the new, .NET 4.x Equivalent scripting runtime, the new features in Unity 2018.2 are a great reason to switch.

33 Comments

Subscribe to comments

leave_a_reply to AndreyClick here to cancel reply.

You may use these HTML tags and attributes: <a href=""> <b> <code> <pre>

  1. Will this library work in the future?
    https://gpailler.github.io/MegaApiClient/index.html

    Right now I get TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a
    Maybe it’s a .NET limitation in Unity…?

    1. I’m not familiar with that specific library. However, everything SSL/TLS should work in 2018.2. Can you post more details on the Unity forums? It might be easier to have a longer discussion there.

      1. @Josh Peterson
        You are right, it was not working on version 2018.1. Now it’s working (at least I tried the login and I did not get the previous error).

        This morning I was still on version 2018.1.
        Thank you for the new improvements.

      2. Ok, I tried the full Api, everything is working (for anyone curious I only had to add MegaApiClient.dll (net46) and Newtonsoft.Json.dll (version 10.0.2 and net45) to the Assets folder).

  2. Tough crowd. I really like the scripting improvements.

    Before: no scripting improvements
    After: people complain because Unity made scripting improvements

    Thanks guys, I appreciate the improvements!

  3. Please add new features & optimization tools for application developing with unity instead of Android Studio, because android studio is sucks

  4. Still no new GC. Will you guys really improve the GC? Unity has no garbage collector, just has a garbage. I think you guys miss the point. We cannot use your **Improvements** features because of GC. You guys should release us from Memory-pool-hell or Spike-hell rather than ‘democratize’ something.

    1. An improve GC is something we’re actively working on currently. It has been a long time in coming, but we will get there.

  5. Bryan Livingston

    July 13, 2018 at 5:15 am Reply

    Why the hell do infinite loops still crash Unity? WTF? Fix that and I’d finally have a good reason to update.

    1. Unity is not crashing. It just hangs. Which is what infinite loops tend to do. Fix your code.

    2. As it turns out, doing this in a way that does not adversely impact performance when you don’t have an infinite loop is pretty difficult. So we’ve not shipped anything yet. As with most or our hack week projects, this was a proof of concept to validate an idea (and a pretty cool one at that).

      We know infinite loops can be a real pain, but we don’t have anything to address this yet.

  6. Some things not implemented in NET 4.x/Net Standard 2.0, but works with NET 3.5 equivalent. (Case 1040632)

    1. Thanks for submitting this bug report, we’ll look to get it corrected.

  7. I switched to 2018.2 hyped about new features but it sucks it has two major bugs
    1.Android app now does not have 2.1 wide screen support don’t know why
    2.astc texture compression failed editor crashed and no solution found by unity support.exe thus editor never opens until you manaully delete the file you tried to compress

    1. If you have not done so, please submit bug reports about these issues. I’m not familiar with either of them specifically, but they will be routed to people who are.

  8. Any news on shadergraph / NET4.x incompatibility ?

    1. Sorry, I’m unfamiliar with this issue (or with shadergraph). Can you point me to some relevant details?

      1. Hi Josh, I faced Shader Graph incompatibility too and was forced to switch back to .NET 3.5. Following error is observed:
        Shader compilation error in graph at line 5 (on ):
        Parse error: syntax error, unexpected ‘,’, expecting ‘)’

        I described it in this post – https://forum.unity.com/threads/feedback-wanted-shader-graph.511960/page-21#post-3559922

        1. Josh Peterson

          July 12, 2018 at 1:52 pm

          Thanks Dan, I’ll have a look there.

  9. I tried to implement entities (only hybrid system, the one with OnUpdate), it works great, but my build size increased from 30 mb to 34 after switching to 4.x

    1. We are still slightly bigger for some cases with the .NET 4.x equivalent runtime, although I’m surprised to see a difference of more than 10%. Please make sure you are using the .NET Standard 2.0 Api Compatibility Level, as it provides a much smaller API from the class libraries, and therefore smaller code.

      If you are still more than 10% larger, we’d love to have a look at your project in a bug report to understand why.

  10. What’s the last version of Unity that supports .JS? I have some long-term projects in need of changes, and sticking with the existing .JS would be a help!

    1. Unity 2018.1 is the last version that supports UnityScript. It has been dropped in 2018.2.

      1. Thank you!

  11. RE: Optimizing build size

    What is the minimum Android apk build size you managed to produce?
    Is it possible to achieve sub-10M for Google Play Instant using .NET 4.6?

    Thanks

    1. I’m not sure about the minimum size. I don’t think we’re at less than 10 megabytes for most non-trivial projects yet, but we have more size improvements coming in 2018.3.

    2. For Google Play Instant you should start with the following instructions:
      – Download and install the Google Play Instant plug-in from github (https://github.com/google/play-instant-unity-plugin) , which will make it easier for you to reach the APK size limit, among other things.

      And sign up for the Google Play Instant Unity beta (here: https://g.co/play/instantbeta) to access the latest updates and guidance on how publish your Google Play Instant Game

      Additionally we encourage you to review the Google Play Instant getting started guide (https://developer.android.com/topic/google-play-instant/getting-started/game-instant-app)

      We are working with Google to accommodate the size limit. In most cases, you have to rely on Asset Bundles to download extra content once the Instant version of your game is downloaded.

      1. Thanks Joshh and JC,
        Here are a few data points for 2018.2.0f2:

        1. a completely empty build on 2018.2.0f2 is at 7MB after cutting _everything_ out:
        – pacman completely empty (no packages, no builtin) meaning not even audio supported (no physics, no UI, no animation, …)
        – IL2CPP (with code stripping)
        – Google Play Instant Unity beta recommended settings (OpenGLES2, ARMv7, micro mscorlib …)
        – Default compression method
        – ProGuard minification
        These 3 extra megs would be a breeze, however as soon as you add something useful (ex: add TextMeshPro, which needs IMGUI and Physics) you are over the 10M budget.

        2. a default empty project with 2018.2.0f2 (only Ads, Analytics and IAP removed in pacman, all Built In packages kept) is above 11MB

        For others trying to optimize their build size, this conversation might help:
        https://github.com/google/play-instant-unity-plugin/issues/4

        Would you guys have other tricks and recommendations to further reduce the build size?
        Thanks

        1. I did try again an empty project (3D Template) with 2810.2f2, just removing the Ads, IAP & TextMesh packages – tested on Windows.
          Building APKs with Scripting Runtime Version .NET 3.5 vs 4.x is about the same size ~7Mb – even slightly smaller with .NET 4.x
          (Settings: OpenGLES2, IL2CPP, API Level .NET Standard 2.0)
          Please make sure you are using the .NET Standard 2.0 API Compatibility Level, as it provides a much smaller API from the class libraries, and therefore smaller code, if .NET 4.x selected for this option, then the APK goes to ~10Mb)

          Finally, shooting for the 10Mb limit for your Google Play Instant is the goal, but first try to go as low as you can and test/submit int the Play Store sandbox to validate the flow.