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.][1]
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!
[1]: /storage/temp/32345-2014-09-12_013622.zip
↧