1

In Unity, trying to use System.Speech in my C# script and I am getting this error:

The type or namespace name 'Speech' does not exist in the namespace 'System' (are you missing an assembly reference?)

I downloaded the System.Speech.dll and put it inside the \Library\ScriptAssemblies of my Unity project, however every time I compile the project, this folder gets cleaned and all the DLL gets lost.

I am new to C# and Unity, is there a way that I can manage to keep the file in the folder? I am trying to find the script that builds the project to modify it and not clean everything before the build, but no solution yet.

luthien
  • 1,285
  • 3
  • 15
  • 26

2 Answers2

3

Instead of putting the DLL file inside \Library\ScriptAssemblies I think the DLL file is just supposed to go into the assets folder then save your project and relaunch unity and visual studio

CubeCrafter360
  • 192
  • 1
  • 13
  • 1
    It worked, the error disappeared and the classes and methods seem to be seen properly. Thanks a lot! – luthien Apr 10 '20 at 21:24
  • I also just had this problem and by putting the ddl file in the assets folder the error disappeared. However, when I run Unity and try to do a simple speech recognition so that it prints a text on a canvas, it doesn't seem to work. I don't know what I am doing wrong. I created a list of some commands, appended them on a GrammarBuilder, created Grammar and loaded them, but also set `recEngine.SpeechRecognized` and started it with `recEngine.RecognizeAsync(RecognizeMode.Multiple);` I put it in my `Start()` method. Would you mind to share your solution on how the recognition works in Unity? – TheHeroOfTime May 30 '20 at 20:57
1

https://docs.unity3d.com/Manual/UsingDLL.html

Managed plugins (dlls) should be put in the assets folder.

sommmen
  • 6,570
  • 2
  • 30
  • 51