1
votes

I am trying to set up speech recognition in Unity using an asset that I bought from their store :

https://www.assetstore.unity3d.com/en/#!/content/72625

It requires an API key. I have tested it with the test API Key provided by the coder and it works. But when I use my own API key it throws a 403 Forbidden Error.

In Google Cloud I had made a new project. I had added the Speech API to the project and set up an API key under credentials. The API key is ticked under the credentials for the API.

There is nothing shown under Traffic, Errors or Latency logs.

Is there another step I may have missed that would grant my Unity asset connection to my API ?

1

1 Answers

0
votes

I came across this question as I had the same issue. I managed to get a tip from the developer to help solve this so allow me to share that with you and also what my problem was specifically in the event that yours is the same.

First thing is, in SpeechRecogntionModule.cs (the file that logs the error) there is a line of code as follows (as per v2.1 it is line 101):

Debug.Log("Speech Recognition have an error: " + _requestWWW.error);

Change this to:

Debug.Log("Speech Recognition have an error: " + _requestWWW.text);

This will then output the whole JSON error response in the console. Click on the log entry in the console to view the expanded feedback and determine your error.

For me, I used the free minutes allowance for the API and needed to set up billing, which I did and used the free credit on offer. Still no luck. When I got my error it was that I had not set up billing for my project. So I went in to the Google API Console and linked the project to the billing I had set up. After that I was back in business. I'll save the instructions on that as you will have a link in your error response that will point at the appropriate help document.