0

I am trying to include Google speech api in my unity app.

I have followed all the steps in the api documentation for c# https://cloud.google.com/speech-to-text/docs/quickstart-client-libraries#client-libraries-install-csharp . I installed this package "Install-Package Google.Cloud.Speech.V1 -Pre" through NuGet package manager but no google references are being shown. This results to the error "The type or namespace name 'Google' could not be found (are you missing a using directive or an assembly reference?)". I checked these possible duplicates but to no avail "The type or namespace name 'Google' could not be found", "The type or namespace could not be found". Switching platform within unity from android to windows shows the google references but without resolving the error.

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);
            }
        }
    }
}
}

The error occurs from the first code line "using Google.Cloud.Speech.V1;". Is it possible that unity cannot support google cloud services or am I missing a step?

it4Astuces
  • 432
  • 5
  • 17
Gluxable
  • 75
  • 9

1 Answers1

3

No, we don't support Unity (or Xamarin) in any of the Google Cloud Client Libraries.

Our supported platforms documentation. It's possible that the REST-based libraries can work on Unity, but we don't support that, and in particular the auth aspects are very likely to fail or require custom code.

To be clear, we'd like to support more platforms, but there's a pretty significant human cost involved in doing so, particularly for gRPC-based libraries where there's a native code component, and also particularly in terms of testing across a whole bunch of client platforms and Unity versions.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194