2016-09-21 231 views

回答

11

Unity還沒有內置這個功能。他們一直在做research很長一段時間,這很可能會很快加入Unity。您可以從Assets商店here中獲得工作的Speech-to-Text(免費)。它是開源的,如果你發現任何問題,你可以幫助contribute

請注意,幾乎每個操作系統都有語音識別API。通過將所有這些API封裝到C#中的單類中,然後使用Unity's platform preprocessor directives來確定要調用哪一個,具體取決於您的遊戲運行在哪個操作系統上。

的Android

SpeechRecognizer類。

的iOS

SFSpeechRecognizer

MacOS的

NSSpeechRecognizer

的Windows

SpeechRecognitionEngine

例子:

class CrazySpeechRecognition 
{ 
    #if UNITY_ANDROID 
    Use SpeechRecognizer class 
    #endif 

    #if UNITY_IOS 
    Use SFSpeechRecognizer class 
    #endif 

    #if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX 
    Use NSSpeechRecognizer class 
    #endif 

    #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN 
    Use SpeechRecognitionEngine class 
    #endif 
} 

從團結的免費Speech-to-Text應該已經解決您的問題。這篇文章的其餘部分是讓你知道,如果Unity出現問題,你可以爲此插件。

+0

感謝您的答覆:-) –

+0

的語音到文本包中包含很多錯誤 –