我正在嘗試在我的unity應用程序中包含Google語音API。我已經按照c#https://cloud.google.com/speech-to-text/docs/quickstart-client-libraries#client-libraries-install-csharp 的api文檔中的所有步驟進行了操作。我通過NuGet包管理器安裝了這個包“Install-Package Google.Cloud.Speech.V1 -Pre”,但沒有顯示谷歌引用。這會導致錯誤“找不到類型或命名空間名稱'Google'(您是否缺少 using 指令或程序集引用?)”。我檢查了這些可能的重復項,但無濟于事“找不到類型或命名空間名稱'Google'”,“找不到類型或命名空間”。將Unity中的平臺從Android切換到Windows會顯示Google引用,但沒有解決錯誤。using Google.Cloud.Speech.V1;using System;namespace GoogleCloudSamples{public class SpeechGoogle{ public static void Main(string[] args) { var speech = SpeechClient.Create(); var response = speech.Recognize(new RecognitionConfig() { Encoding = RecognitionConfig.Types.AudioEncoding.Linear16, SampleRateHertz = 16000, LanguageCode = "en", }, RecognitionAudio.FromFile("audio.raw")); foreach (var result in response.Results) { foreach (var alternative in result.Alternatives) { Console.WriteLine(alternative.Transcript); } } }}}該錯誤發生在第一個代碼行“using Google.Cloud.Speech.V1;”中。有沒有可能unity無法支持谷歌云服務,或者我錯過了一個步驟?
- 1 回答
- 0 關注
- 144 瀏覽
添加回答
舉報
0/150
提交
取消