The Dialogflow V2 Unity Plugin is a continuation from Api.ai: Unity Plugin,
which made it easy to integrate the Dialogflow(Api.ai) natural language processing API into your Unity project.
It's a team project in Open Source Studio and not an official plugin from Google or Unity.
The project will continue on 2019 as a part of ITP xStory.
Create the file system in any location, and open in a terminal.
Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the file path of the JSON file that contains your service account key using this command: export GOOGLE_APPLICATION_CREDENTIALS=YOUR_JSON_PATH
Optional. Confirm the variable using this command: echo $GOOGLE_APPLICATION_CREDENTIALS
Install the Latest Cloud SDK & Get the Access Token
Extract the contents of the file to any location on your file system.
Run gcloud init to initialize the SDK using this command: ./google-cloud-sdk/bin/gcloud init
Finish initializing and run gcloud auth to get access token using this command: ./google-cloud-sdk/bin/gcloud auth application-default print-access-token
Create JsonData Script Inside Plugins Folder of Unity
Download or copy JsonData.cs from the GitHub repository.
Open your Unity project, and create Plugins folder inside Assets.
In the Plugins folder, create new C# Script and paste the JsonData.cs.
Create Dialogflow API Script Inside Assets of Unity
Download or copy MicrophoneCapture.cs and WavUtility.cs from the GitHub repository, and insert them in the same Unity Plugins folder (with other C# Script files).
Insert YOUR_PROJECT_ID and YOUR_ACCESS_TOKEN in MicrophoneCapture.cs.
STEP 1 & 2 will automatically create a button that uses your microphone to send audio query.