I am using VS 2017 and unity 2017.1.0f3. I want to use system.speech(.net 4.6) dll in my unity project. How can I do that?
I don’t see System.Speech.dll in the class libraries that ship with Unity, so you will need to manually copy this assembly into your Unity project, as you would have any other third-party assembly.
Thanks for reply. I am trying to do that. I have done following steps:
- I copied the system.speech.dll from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6
- Placed system.speech.dll in Assets\Plugins
- I built VS project and it’s created in new folder after that I am seeing Loading script assembly “Assets/Plugins/System.Speech.dll” failed!
Can you help me here what’s happenning.
I am using player settings with .Net 4.6
Does the Unity Editor.log file have any other details about what the error message?
The error message itself is Loading script assembly"Assets/Plugins/System.Speech.dll" failed.
I don’t see any other error message as of now.
my bad, let me share complete logs
In general, you cannot just copy dlls from .NET Framework and expect them to work.
Specifically to this case, you seem to be copying a reference assembly **C:\Program Files (x86)\Reference Assemblies**
which has no implementation code. This is a just an assembly with APIs to compile against, not run against.
Thnaks joncham. Can you tell how to use dll present in `C:\Program Files (x86)\Reference Assemblies\ .
Ahh, sorry I missed that this was a reference assembly. These are a bit different than what you expect. They don’t contain any real code that executes. Instead, they just have the API surface to compile against. The runtime will then forward the calls on that API surface to real code that does the work.
So it is not possible to use any reference assemblies at runtime!
what is the best way to consume system.speech.dll in my unity application and it’s not present in C:\Program Files\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\Facades
Sorry, I’m not at all familiar with System.Speech.dll, so I can’t offer any advice.
In NuGet, there is a System.speech.dll available for both .NET 4.5 and .NET standard 2.0.
However, I’m not sure that will work with Unity currently. Although it contains the necessary references to get Unity to find everything and compile, at runtime, the use of the methods within the assembly do not seem to be supported for a Windows platform [which should be the only platform it could run in].