Im trying to make use of System.Speech in a unity windows standalone application.
I cannot simply be Using System.Speech because Unity doesnt support it.
Added the .Net System.Speech to Unity in the PLugin folder allows me to write my code and unity happily compiles.
It will not run in the editor, leading to an editor crash, not can I build a standalone, getting a “ArgumentException: The Assembly sysglobl is referenced by System.Speech. But the dll is not allowed to be included or could not be found.”
I’m not familiar with this specfic library. In general there’s a few things to take into account when trying “some .net feature”. A good first one is to check the mono website to see if it’s supported or not. A second thing to do is to use a tool like ILSpy to take a look at the assembly that you want to use. It will show you the dependencies the assembly has (you can probably use it to figure out what that sysglobl thing is about), and you can also use it to scan for “extern” methods.
.net libraries that simply contain .net (e.g. C#) code will work out of the box in Unity.
Some .net libraries however are merely a wrapper around a C library. They will use a technique called P/Invokes, to call the c library from c# code. in order to make these libraries work, you need to make sure that the dependent c library is available to Unity as well. (placing it in the same directory as the unity player executable usually does the trick).
Another type of .net library that won’t work is also one that only contains wrapper code, but where the native code it wraps is located inside the .net runtime instead of a c library. These functions are often referred to as ‘icalls’. In such a case, it is likely that the .net runtime implements these icalls, but the mono runtime doesn’t. Checking the mono website for compatibility of your library should be a good start here.
How do I figure out if its using the icalls?
I see nothing about icalls in MoMA nor ILSpy.
I used ILSpy to figure out and add the dependencies listed.
I fixed the build errors with libraries, but both editor and standalone crashes the hard way on play with access violations.