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

Referencing System.speech(.net 4.6) dll in unity 2017.1.0f3

Discussion in 'Experimental Scripting Previews' started by migupta, Jan 24, 2018.

  1. migupta

    migupta

    Joined:
    Jan 23, 2018
    Posts:
    11
    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?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    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.
     
  3. migupta

    migupta

    Joined:
    Jan 23, 2018
    Posts:
    11
    Thanks for reply. I am trying to do that. I have done following steps:
    1. I copied the system.speech.dll from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6
    2. Placed system.speech.dll in Assets\Plugins
    3. 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
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    Does the Unity Editor.log file have any other details about what the error message?
     
  5. migupta

    migupta

    Joined:
    Jan 23, 2018
    Posts:
    11
    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.
     
  6. migupta

    migupta

    Joined:
    Jan 23, 2018
    Posts:
    11
    my bad, let me share complete logs
     
  7. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    276
    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.
     
  8. migupta

    migupta

    Joined:
    Jan 23, 2018
    Posts:
    11
    Thnaks joncham. Can you tell how to use dll present in `C:\Program Files (x86)\Reference Assemblies\ .
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    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!
     
  10. migupta

    migupta

    Joined:
    Jan 23, 2018
    Posts:
    11
    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
     
  11. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    Sorry, I'm not at all familiar with System.Speech.dll, so I can't offer any advice.
     
  12. bgahouse

    bgahouse

    Joined:
    Dec 5, 2016
    Posts:
    1
    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].