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
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Future of grpc-dotnet in Unity (which means .NET 6)?

Discussion in 'Experimental Scripting Previews' started by Claytonious, Jan 13, 2022.

  1. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    900
    It sounds like the official grpc-dotnet will work in Unity once .NET 6 support lands in Unity (mainly because it requires HTTP/2). Does this still sound correct from Unity's perspective? Do we have any idea what the ETA of .NET 6 in Unity is, even in an experimental release state? We would be happy to help torture test it with some GRPC experiments on various devices.
     
    RageAgainstThePixel likes this.
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    Yes, we don't expect to have HTTP/2 support in Unity until we start to use the .NET 6 base class libraries.

    No, we don't have an ETA yet - we're working internally on this, but it is a long road, and we're not close enough to share any releases or dates publicly yet.
     
  3. daglindbo

    daglindbo

    Joined:
    May 21, 2021
    Posts:
    1
    Claytonious likes this.
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    Currently Unity only support HTTP 1. HTTP/2 support will be coming with .NET 6/7, but I don't have an ETA yet for that support in Unity. I would not expect it in the next few months at least though.

    I'm not familiar enough with gRPC to know about workarounds for lack of HTTP 2 support unfortunately.
     
    daglindbo likes this.
  5. nils_vixel

    nils_vixel

    Joined:
    Jan 3, 2023
    Posts:
    2
    FYI, I am sure you are aware of this, but the EOL maintenance for Grpc.Core is set for May 2023.

    https://grpc.io/blog/grpc-csharp-future/

    > Update 2022-05-03: The maintenance period for Grpc.Core has been extended until May 2023. See announcement for more info on the future of Grpc.Core.

    This non-support for Grpc.Net.Client is causing a lot of problems and extra work for a lot of Unity developers.

    For instance, when targeting multiple platforms, we must handle the proper platform specific native libraries.

    Additionally, the requirement on Grpc.Core has cascading effects on many upstream library dependencies in our project assets, which is starting to become really troublesome.
     
    RageAgainstThePixel likes this.
  6. doctorseus

    doctorseus

    Joined:
    Feb 27, 2013
    Posts:
    12
    You can check out https://github.com/doctorseus/grpc-dotnet-unity where I added support for gRPC using an alternative HTTP2 client from the Asset Store without any native code / platform dependencies. It will hopefully bridge the time for us until we get .NET 6/7 support which I would assume is not happning for quite some time.
     
    bdominguezvw and Deleted User like this.
  7. Deleted User

    Deleted User

    Guest

    Hello @doctorseus! Thanks for sharing!
    I tried to use tour classes and got my project to work perfect in UnityEditor, but i got completely locked thread in a build, while calling
    Code (CSharp):
    1. _grpcCall.RequestStream.WriteAsync(request).Wait();
    for the very first time.

    Write task never ends. Is there anything i am probabbly missing?
     
  8. doctorseus

    doctorseus

    Joined:
    Feb 27, 2013
    Posts:
    12
    Have a look at the usage examples in the git repo. If you call .wait() then you will simply block the Unity main thread. Instead, use the async methods (with await) to just trigger the processing once a response actually arrives.
     
  9. goldsphere

    goldsphere

    Joined:
    Feb 10, 2018
    Posts:
    5
    Is any updates about HTTP/2 ? I want to use MagicOnion which based on grpc. I compiled grpc-dotnet by my self to .net-standrard2.1 library. I'm using IL2CPP compiler and .netstandard2.1 in player settings. My Unity version is 2021.3.20. But I've still got error "Bad gRPC response. Response protocol downgraded to HTTP/1.1".
    Maybe I've lost some updates ?
     
  10. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,061
    No updates. Unity will only support HTTP/2 after the upgrade from mono to .Net, which is still some ways off (Unity 2024 at the earliest).
     
  11. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    102
    what's the latest status here?
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    There are no updates yet. We are working on support for .NET 8 in Unity (which will include HTTP/2 support), but I don't have an ETA for a release to share yet.
     
  13. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    102
    Ok, thanks