Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

SpeechLib works fine in editor but not in runtime

Discussion in 'Editor & General Support' started by Kargan, Apr 10, 2020.

  1. Kargan

    Kargan

    Joined:
    Apr 26, 2017
    Posts:
    1
    Hi,

    I am trying to use SpeechLib to implement Text-To-Speech in Unity, it works fine in the editor but I get an exception when running a build on windows.

    Here is my script :

    Code (CSharp):
    1. using UnityEngine;
    2. using SpeechLib;
    3.  
    4. public class TTS : MonoBehaviour
    5. {
    6.     private SpVoiceClass voice;
    7.  
    8.     private void Start()
    9.     {
    10.         voice = new SpVoiceClass();
    11.     }
    12.  
    13.  
    14.     // Use this for initialization
    15.     void Update()
    16.     {
    17.         if (Input.anyKeyDown)
    18.         {
    19.             voice.Speak("TEST");
    20.         }
    21.     }
    22. }
    And the logs :


    NotSupportedException: Specified method is not supported.
    at System.__ComObject..ctor () [0x00006] in <c79628fadf574d3a8feae0871fad28ef>:0
    at (wrapper cominterop) SpeechLib.SpVoiceClass..ctor()
    at TTS.Start () [0x00001] in C:\Users\leosa\OneDrive\Documents\TTS\Assets\Scripts\TTS.cs:12
     
  2. Thriliriel

    Thriliriel

    Joined:
    Jan 29, 2015
    Posts:
    10
    I am having exactly the same problem. Have you found a solution?
     
  3. ShadyBoshra2012

    ShadyBoshra2012

    Joined:
    Oct 7, 2019
    Posts:
    3
    Is there any updates? I am facing same problem.
     
  4. ShadyBoshra2012

    ShadyBoshra2012

    Joined:
    Oct 7, 2019
    Posts:
    3
    I found the solution.

    Steps:

    1. Build Settings
    2. Player Settings
    3. Make sure you selected "Standalone" tab
    4. Open "Other Settings" tab
    5. Api Compatibility Level: choose .Net 4.x
    6. Save and build
     
    drin1drin and Thriliriel like this.