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

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 ?

what exception do you get?
that’s like one of the most important questions here… :slight_smile:

The exception is some internal error related to the actual Google speech library:

This doesn’t sound like a .net error, but more like a library functionality error, quick googling brought up this: Google Datastore authentication issue - C# - Stack Overflow maybe this helps.

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.

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?)

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).

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.

This looks good. Thanks!

Any updates with that bug?

No, sorry, we don’t have any updates on this bug report yet.

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 ?

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.

Oh, okay. Thanks

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.

I’ve just confirmed that this is working on 2018.2. Please give it a try once 2018.2 is in public beta.

great news, thanks !