用了这么长时间unity,今天才了解到unity是自带语音识别的,只不过只能加以特定的关键字来进行识别
Unity自带的语音识别功能官方有API供参考,地址在这里
https://docs.unity3d.com/ScriptReference/Windows.Speech.PhraseRecognizer.html
话不多说,直接上代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Windows.Speech;//引入命名空间 利用
/// <summary>
/// 语音识别(主要是别关键字)
/// </summary>
public class speechKey : MonoBehaviour