Search Unity

Unity では、前回の更新以来、スクリプティングランタイムの改良に取り組んでまいりました。Unity 2018.2 では、スクリプティングランタイム関連の数十個のバグ修正が行われています。これは、Unity 2018.1 で .NET 4.x Equivalent スクリプティングランタイムが公式対応になって以来、皆様から寄せられた素晴らしいフィードバックのおかげです。また、.NET 4.x Equivalent スクリプティングランタイムでのみ利用可能な各種機能も追加されており、プロジェクトの切り替えがさらに行いやすくなっています。

IL2CPP でマネージドコードデバッグが可能に

Unity 2018.2 の公開により、IL2CPP スクリプティングバックエンドでマネージドコードデバッグが可能になりました。Mono スクリプティングバックエンドと同じ機能がすべて使用可能になっています。IL2CPP ビルドのビルド設定で Script Debugging のオプションを有効にして Unity プレイヤーをデプロイするだけで、Visual Studio などの素晴らしいツール(および、Unity で機能するその他すべてのデバッガー)を使用してデバッグを行えます。

IL2CPP の場合も Mono の場合と同様、デバッガーはデバイス上で実行されている Unity プレイヤーにアタッチされます。したがって、IL2CPP を実行しているプレイヤーのリモートデバッグも可能です。

デバッグは、Xbox One 以外のすべての IL2CPP プラットフォームで利用可能です。(Xbox One デバッグも 2018.3 で可能となる予定です。)

.NET がモダンな SSL/TLS に対応

.NET 4.x Equivalent スクリプティングランタイムにより、(Unity の全プラットフォームで、かつ、Mono と IL2CPP の両方で)すべての .NET クラスライブラリ API が TLS 1.2 に完全対応になります。Unity が OS と正常に連携するようになり、ローカル認証ストアへのアクセスや、安全なソケットおよび HTTPS 接続が期待通りに行えるようになりました。

ビルドサイズの最適化

.NET 4.x Equivalent スクリプティングランタイムの提供する API Compatibility Level により、デベロッパー待望の様々な有用な .NET API が利用可能になります。また、.NET クラスライブラリからより多くのコードが利用可能になりました。これはビルドサイズを大きくする可能性があります。Unity 2018.2 および(今後公開予定の)Unity 2018.3 では、.NET 4.x Equivalent を使用した場合のビルドサイズを可能な限り小さくすることに注力しています。

Unity が行ったテストによると、(旧スクリプティングランタイムから新スクリプティングランタイムに切り替えた実際のプロジェクトの多くで)Unity 2018.2 によるビルドサイズの増大は 2% 未満となっています。バージョン 2018.3 には、よりアグレッシブなマネージドバイトコードストリップなどの新機能や、更なる改良が含まれる予定です。

.NET の未来は明るい

以上、.NET 4.x Equivalent スクリプティングランタイムに関して現時点までに実現できた改良のいくつかをご紹介しました。これにより Unity デベロッパーの皆様の開発作業が少しでも快適になることを願っています。バージョン 2018.3 で更なる改良をお届けすべく、Unity では引き続き「ゲーム開発を民主化する」取り組みに尽力中です。

Unity 2018.3 では .NET 4.x Equivalent スクリプティングランタイムが Unity プロジェクトのデフォルト設定となり、.NET 3.5 Equivalent スクリプティングランタイムは非推奨化されます。.NET 3.5 Equivalent スクリプティングランタイムは 2019 年のリリースサイクルで Unity から削除される計画です。

ご自分のプロジェクトで新しい .NET 4.x Equivalent スクリプティングランタイムをまだお使いになっていない方は、ぜひお試しください。Unity 2018.2 の新機能の数々は、きっと切り替えるに十分な価値をもたらしてくれるでしょう。

33 コメント

コメントの配信登録

コメント受付を終了しました。

  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. Josh Peterson

      7月 16, 2018 2:08 pm

      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. Josh Peterson

      7月 16, 2018 2:10 pm

      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

    7月 13, 2018 5:15 am

    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. Josh Peterson

      7月 16, 2018 2:13 pm

      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. Josh Peterson

      7月 16, 2018 2:14 pm

      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. Josh Peterson

      7月 12, 2018 1:49 pm

      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. Josh Peterson

      7月 11, 2018 9:27 pm

      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

          7月 12, 2018 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. Josh Peterson

      7月 11, 2018 9:11 pm

      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. Adams Immersive

    7月 11, 2018 8:45 pm

    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. Josh Peterson

      7月 11, 2018 8:53 pm

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

      1. Adams Immersive

        7月 12, 2018 2:05 am

        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. Josh Peterson

      7月 11, 2018 8:26 pm

      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. JC Cimetiere

      7月 11, 2018 8:44 pm

      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. JC Cimetiere

          7月 12, 2018 12:49 am

          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.