- Home /
SpeechLib.SpVoiceClass:GetVoices does crash my Unity executable
I created a project with Unity (version 4.5.3f3). I only wrote a simple script as follow:
using UnityEngine;
using System.Collections;
using SpeechLib;
public class SpeechTest : MonoBehaviour
{
private SpVoice voice;
void Start()
{
voice = new SpVoice();
ISpeechObjectTokens voices = voice.GetVoices();
}
// Update is called once per frame
void Update()
{
if (Input.anyKeyDown)
{
voice.Speak("Hello, world!", SpeechVoiceSpeakFlags.SVSFlagsAsync);
}
}
}
Here you can download the test project for Unity: https://dl.dropboxusercontent.com/u/12184013/TextToSpeech.zip
When I try to play (in Unity editor), the game runs without problems. Instead, when I build and run the game, I receive a message error:
The game crashed. The crash report folder named "2014-09-12_013622" next to game executable. It would be great if you'd send it to the developer of the game!
The zipped folder "2014-09-12_013622" is attached to this post.
When i comment this line
ISpeechObjectTokens voices = voice.GetVoices();
the game doesn't crash after I rebuilt it.
I need to call GetVoices method, because I want to set a new voice in the "SpVoice voice" object.
Thanks in advance to everybody!
Answer by DaG_II · Sep 14, 2014 at 10:59 AM
Here is the solution: http://forum.unity3d.com/threads/speechlib-spvoiceclass-getvoices-does-crash-my-unity-executable.268011/#post-1772720
In a nutshell the library [Unity Install Directory]\Editor\Data\Mono\lib\mono\2.0\CustomMarshalers.dll should be included in the Unity project (adding it as a asset).
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Why do I get this error when I export my code to android phone? 0 Answers