使用RTVoice预制体就可以了,可以转汉字和英文,标点符号不行。
自己写的测试代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Crosstales.RTVoice;
public class VoiceDemo : MonoBehaviour
{
public InputField mTxtSpeakContent;
public Button mBtnClick;
private string mID;
// Start is called before the first frame update
void Start()
{
mBtnClick.onClick.AddListener(() => {
//Speak(mTxtSpeakContent.text);
mID = Speaker.Instance.Speak(mTxtSpeakContent.text);
});
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.P))
{
mID = Speaker.Instance.Speak("测试语音功能是否正常!Test whether the voice function is normal",null, Speaker.Inst