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

Mono Upgrade Can i use any .NET 4.5 library with Unity now ?

Discussion in 'Experimental Scripting Previews' started by liortal, Nov 27, 2017.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Now that we have .NET 4.6 support, i am trying to integrate the Google cloud speech API into Unity.

    This library is available as a NuGet package, and with the lack of NuGet support in Unity, i had to resort to a bit of hacking:

    I imported it into a visual studio project, let it download all required DLLs and them copied them off to my Unity project, but this doesn't work (throws an exception at runtime).

    My question is: should any .net 4.5 library (theoretically) be supported now with Unity? or are there any other limitations ?
     
  2. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    what exception do you get?
    that's like one of the most important questions here... :)
     
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    The exception is some internal error related to the actual Google speech library:
     
  4. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    There are a few limitations, but not too many. Unity doesn't support Windows forms, for example (although I doubt this library uses that code). Most of .NET 4.5 should be available, and our goal is to make everything available that we possibly can.

    Of course a number of .NET libraries implicitly assume a JIT runtime is available, so you might run into more problems on AOT platforms.

    This specific error looks pretty general though, so I can't say if there is some missing .NET support here or not. Is it possible to test the same code in a standalone application? It might be worth trying it with the .NET Framework or Mono separate from Unity. If it working in either of those cases, we likely have a bug in Unity.
     
  6. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Hi Josh, thanks for the reply.

    I did test it using a standalone (.net 4.5) console app and it worked. In Unity, if i attached the debugger and set it to break on any exception (.net exception that is), it shows a few exceptions related to certificate handling or something similar to that (can't recall right now).

    I have a minimal project to reproduce that, if you'd like i can share it with you (should i file a bug report or just send it over to you?)
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Please file a bug report and let me know the case number, then I can find it and route it properly.

    This might be related to the lack of SSL support and certificates for .NET APIs in Unity (which is something we are nearly ready to correct and ship).
     
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I just files a new bug report:
    (Case 973859) RpcException when trying to use Google Speech API libraries (.net 4.5)

    Let me know if it is detailed enough or if you need anything else.
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    This looks good. Thanks!
     
  10. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Any updates with that bug?
     
  11. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    No, sorry, we don't have any updates on this bug report yet.
     
  12. rchugh

    rchugh

    Joined:
    Feb 16, 2018
    Posts:
    2
    Hi liortal,
    I am facing similar problem with Google Speech recognition streaming API, I am getting run time exceptions that I am unable to remove. Were you able to get your code working ?
     
  13. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    No, it never worked. Probably due to the lack of support for SSL and what was mentioned above.

    I opened a bug for this and tried to ping them to get the latest status, but unfortunately there were no updates at all.
     
  14. rchugh

    rchugh

    Joined:
    Feb 16, 2018
    Posts:
    2
    Oh, okay. Thanks
     
  15. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Yes, we've not tracked down the cause of this issue yet. It looks like we will have proper SSL support in 2018.2 though, so I suspect that this will work then. We will re-visit the bug report soon in the 2018.2 version of Unity.
     
  16. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    I've just confirmed that this is working on 2018.2. Please give it a try once 2018.2 is in public beta.
     
  17. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    great news, thanks !