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

.NET 4.7 and future versions

Discussion in 'Experimental Scripting Previews' started by pavelkouril, Jan 28, 2018.

  1. pavelkouril

    pavelkouril

    Joined:
    Jul 22, 2016
    Posts:
    129
    Hello,

    I know .NET 4.6 is still experimental, but I am wondering about the support of .NET 4.7, and also future versions of .NET (how long will it take Unity to catch up - if it will be matter of months or years). I understand that giving estimates is hard, but I guess you have some "if everything goes right" timeline in mind?

    I'm asking because of two reasons;
    - Span<T>, available in C# 7.2
    - Intrinsics, which could be partially available in .NET Standard 2.1 (https://github.com/dotnet/corefx/issues/22940)

    Both of these things could really help with performance of Unity applications, so pardon my impatience. :)
     
    S_Darkwell likes this.
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    While we don't have any specific plans to announce now, we are generally planning to track improvements in the .NET ecosystem like this as closely as possible. I would expect catch-up to be on the order of weeks or months, depending on how releases align in the future.

    We are thinking about way to use features like Span and intrinsics in Unity, although our approach might differ slightly. If you have not seen it yet, I would recommend watching this talk to get an idea about the way we are heading:

     
    mkderoy and S_Darkwell like this.
  3. pavelkouril

    pavelkouril

    Joined:
    Jul 22, 2016
    Posts:
    129
    Hello,

    yes, I know about these upcoming features; does the "although our approach might differ slightly" mean you are unlikely to support the approach provided by a future .NET Standard (based on the PRs and discussions it seems it will go through), or will you just support both?

    Because especially the access to intrinsics directly from "userland" code would be great. ;)

    As well as if you could port the code in Mathf and vectors/matrices/etc. to use intrinsics in the future (whereever possible), that would be great too - because a new math library sounds cool, but porting old code to it would be probably be a pain in the ass (pardon my french), especially if it would include new Vector/Matrix/Quaternion types. :/
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    I'm not sure about our future support for intrinsics, although we do want to support new versions of .NET Standard. I'll see if I can find more information about our future plans.
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    I've talked with our Scripting Team, and have a few more details.

    Regarding Span<T>, we are not going to use it directly, but we are providing our own buffer types. Span<T> is too limited for our use cases, and having full control over the runtime allows us to define a more powerful data structure. Span<T> will work once we get C# 7.2 support (which is planned) but we won't base our API on it.

    Regarding intrinsics, we are providing our own math library that gets optimized by the Burst compiler. It matches almost 1 to 1 the HLSL math library (this is discussed some in the video) if intrinsics will end up in the standard, they will work, and we might end up adding optimized support for them in Burst too.
     
    MechEthan likes this.
  6. pavelkouril

    pavelkouril

    Joined:
    Jul 22, 2016
    Posts:
    129
    Ok, thanks for the clarification! :)

    Looking forward to the catch-up to 7.2, and other improvements in the future. But I guess first even the .NET 4.6 has to become stable, instead of its current experimental state; hoping this will happen sooner than later. :)