使用 SpeechLib 事件,我的 unity3D 崩溃了,如何处理?

问题描述

当我像“Word”或“StartStream”一样使用事件时,当我尝试在 Unity Editor 中播放时,我的 unity 崩溃了。Build 也没有用。我只想在播放声音时获取角色位置. 如果代码不包含 SpVoice 的任何事件,则它运行没有任何问题。

Windows 10
Unity2019.4.24f
Visual Studio 2019

这是我的代码,“播放”功能用于按钮:

using UnityEngine;
using UnityEngine.UI;
using SpeechLib;

public class ReadWords : MonoBehavIoUr
{
    SpVoice voice;
    private void Start()
    {
        voice = new SpVoice();
        voice.Word += Voice_Word;
    }

    private void Voice_Word(int StreamNumber,object StreamPosition,int CharacterPosition,int Length)
    {
        Debug.Log(CharacterPosition);
    }

    public void Play()
    {
        string txtContent = GameObject.Find("InputField").GetComponent<InputField>().text;
        voice.Speak(txtContent,SpeechVoiceSpeakFlags.SVSFlagsAsync);
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)