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

GDC 2022: The Future of .NET and Unity

Discussion in 'Experimental Scripting Previews' started by JoshPeterson, Mar 21, 2022.

  1. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    We will be having a discussion March 21 at 3:50pm US Pacific Time at the Unity Dev Summit at GDC:

    https://schedule.gdconf.com/session/the-future-of-net-and-unity-presented-by-unity/886907

    We'd love to have anyone able to make it in-person to the event join us in the room. For those who cannot attend, we will be publishing the full recording of the talk along with a blog post in a few weeks.

    Let's open a thread here for discussion about the talk.

    For those just joining our larger discussion around the future of .NET and Unity, we also have a great forum thread here:

    https://forum.unity.com/threads/unity-future-net-development-status.1092205
     
  2. WinterboltGames

    WinterboltGames

    Joined:
    Jul 27, 2016
    Posts:
    259
    Any reason for the delayed release of the recording?
     
  3. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    From what I have been told, we won't have access to it for a few weeks. We'll get it released as soon as we have access to it.
     
    WinterboltGames likes this.
  4. WinterboltGames

    WinterboltGames

    Joined:
    Jul 27, 2016
    Posts:
    259
    Thanks for your reply. I'm really excited about this talk.
     
    JoshPeterson likes this.
  5. Well, GDC is/was selling online-only tickets, I guess it would defeat the purpose if we got the content for free right away.
     
    DragonCoder likes this.
  6. WinterboltGames

    WinterboltGames

    Joined:
    Jul 27, 2016
    Posts:
    259
    Oh, completely forgot about that :p
     
  7. noumenous

    noumenous

    Joined:
    Mar 22, 2022
    Posts:
    1
    Has a blog post or other summary been released that covers the content of this session for those of us not attending GDC this year?
     
  8. TheRobWatling

    TheRobWatling

    Joined:
    Feb 18, 2013
    Posts:
    44
    To quote JoshPeterson
     
  9. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    Yes, the video was posted earlier in the week, but the audio quality was very bad. Our video processing company is currently re-doing the videos and we will post it again when it is ready.

    The blog post is in-progress, although now is scheduled for May, as we have a good bit of unrelated blog content in the pipeline for the Unity 2022.1 release.

    I will post on this thread when we have a video with good audio quality ready.
     
    jGate99 and Anthiese like this.
  11. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    Thank you! That's perfect
     
  12. I know it's not your responsibility, but you may be able to reach the people, who are... please stop posting your videos 'unlisted'. It is extremely tiresome to hunt down various Youtube videos on various websites. We could just open up Unity's Youtube account and see all the videos... Unity lately is submitting everything unlisted and hide videos on landing pages. :( I know, marketing and all, but I'm sure there are better solutions for this.
     
    DevViktoria, oli-2019 and NotaNaN like this.
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    I'll mention that, thanks!
     
    NotaNaN and Lurking-Ninja like this.
  14. Ran-Quan

    Ran-Quan

    Joined:
    Mar 16, 2017
    Posts:
    5
    @JoshPeterson Thanks for the great talk!
    One of my questions is that the current serialization and domain reload process does not scale very well with the growing number of packages and tools built with managed code. It's painful to work on large complex projects with a lot of package dependencies. Will things get even worse after the introduction of NuGet packages and msbuild? Do you have a plan to fundamentally change the reload process so that we can have significantly faster iteration time?
     
  15. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    The answer is AssemblyLoadContext:
    https://forum.unity.com/threads/unity-future-net-development-status.1092205/page-17#post-8060684

    It's still in the prototype phase, nothing guaranteed, but it's looking great on the paper!
    Imagine you're working on the big project and change something in the Assembly-CSharp.dll, since nothing depends on it, all you need to do is to reload that :)

    When working on something else (e.g. you modify script in some package), it will reload more assemblies, but it's shouldn't be that common and for an occasional bug fix it's fine. The most important thing is that Unity assemblies doesn't need to reload ever (in ideal case).
     
  16. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    The audio has been corrected on the recording of the talk. You can find it here:
     
    LuGus-Jan, NotaNaN, marcospgp and 3 others like this.
  17. dpeter99

    dpeter99

    Joined:
    Sep 29, 2013
    Posts:
    7
    Great talk!
    I really hope we can see some of that bright future soon.
     
    JoshPeterson likes this.
  18. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
  19. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    JoshPeterson likes this.
  20. Recatek

    Recatek

    Joined:
    May 2, 2020
    Posts:
    30
    Hi @JoshPeterson, loved the GDC talk and this all sounds very exciting for the future of Unity.

    During the talk, around 13 minutes in, you describe a custom in-house marshalling layer for C#/C++ interop for the engine layer, with advantageous performance characteristics compared to P/Invoke. Are there any plans to expose this kind of interop to users of the engine? I often use native DLLs in my projects and being able to benefit from Unity's own improved native interop tools would be very helpful.

    Certainly that mixed mode debugging sounds like a huge improvement if it works with user-provided native (Rust?) DLLs.
     
    Last edited: May 18, 2022
  21. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    No, we don't plan to expose this externally. Most of the improved performance is around thing very specific to the Unity engine native code, like the way objects or strings are represented in memory. I'm not sure that it would be generally applicable.

    I've tried mixed mode debugging in our early work with user-provided C++ DLLs that we have. I've not tried it with Rust, and I don't know much about the Rust debugging story with Visual Studio. But the native/managed debugging with CoreCLR embedded in Unity works the same way as it work in a normal .NET application, so I would expect the same behavior.
     
    Recatek likes this.
  22. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    With new C# versions, you'll be able to use IL instruction
    Calli
    indirectly. The feature providing this is called Function pointers and is available in C# 9.0 draft. On top of this, you'll be able to suppress GC transition when making unmanaged call.

    These two features can get you as much performance as possible when calling native code.

    Btw, Calli was also used looong time ago by @xoofx when making SharpDX.
    At that time he didn't have compiler support for Calli, so he used DLL patching or similar method to sneak that in.

    More information here:
    https://docs.microsoft.com/en-us/do...erence/proposals/csharp-9.0/function-pointers
     
    xoofx and Recatek like this.
  23. Friedrich_S

    Friedrich_S

    Joined:
    Mar 23, 2018
    Posts:
    3
    Hey,
    I have been using Rust in Unity for a long time now, mostly with a custom library loading layer. It works really well, and I enjoy it a lot because of Rust itself and the highly improved performance over Unity C# (sometimes orders of magnitude faster). We also investigated ways of automated real-time bindings generation with Code Orchestra. We were able to seamlessly integrate C# into C++ code (with bidirectional bindings so that C++ can interact with code written in C#) and Rust would have been the next target. The same technology could be adapted to work in Unity.

    Here are some demo videos of the technology in action:



    I have also been working on the Cinematic Rendering Pipeline (CRP), which is a massively enhanced version of DenseLOD (which was mentioned on the forum a while ago: https://forum.unity.com/threads/so-nanite.889714/page-3). It is a fully custom DirectX12 rendering engine implemented in pure Rust and a rendering backend abstraction compatible with Vulkan. The DenseLOD part is essentially a Nanite-like technology for rendering an infinite amount of geometry. The second-latest iteration of CRP easily managed 100 billion triangles, with the latest version being significantly faster but still unfinished. The other major part is a custom light pipeline with real-time global illumination and support for the latest ray tracing features. Since CRP is implemented from scratch and highly decoupled from Unity itself, it could be used anywhere and is also not limited by what Unity supports but instead by what the latest DirectX/Vulkan features are.


    We are happy to cooperate with the Unity teams regarding the use of CO in Unity to provide first-class support for arbitrary languages or CRP to provide next-gen graphics without sacrificing performance.