Use this SDK to build Watson-powered applications in Unity. It comes with a set of prefabs that you can use to develop a simple Watson application in just one minute.
Ensure that you have the following prerequisites:
- An IBM Bluemix account. If you don't have one, sign up.
- Unity. You win! You can use the free Personal edition.
You can get the SDK by cloning the the repository from GitHub.
-
Clone the following GIT repository into a directory within your current Unity project.
- git clone https://github.com/watson-developer-cloud/unity-sdk.git
- OR
- git submodule add https://github.com/watson-developer-cloud/unity-sdk.git
- OR
- Click on the "Download Zip" button at the following URL https://github.com/watson-developer-cloud/unity-sdk, extract the zip file into your project directory.
- git clone https://github.com/watson-developer-cloud/unity-sdk.git
- Download the
WatsonDeveloperCloud.unitypackage
file. - Open Unity, then open your project or create a new one.
- Add the Watson SDK package by selecting Assets -> Import Package -> Custom Package.
- Navigate to the location of the
WatsonDeveloperCloud.unitypackage
, and click Open. The Importing package window is displayed. - Click Import. The asset is imported, and the prompt to configure your Watson service credentials is displayed.
- Click Yes. The Config Editor is displayed, and the Watson services to be configured are in the list.
- Go to Configuring Watson service credentials.
- Determine which services to configure.
- If you have configured the services already, complete the following steps. Otherwise, go to step 3.
- Navigate to the Dashboard on your Bluemix account.
- Click the tile for a service.
- Click Service Credentials.
- Copy the content in the Service Credentials field, and paste it in the credentials field in the Config Editor in Unity.
- Click Apply Credentials.
- Repeat steps 1 - 5 for each service you want to use.
- If you need to configure the services that you want to use, complete the following steps.
- In the Config Editor, click the Configure button beside the service to register. The service window is displayed.
- Click Create.
- Click Service Credentials.
- Copy the content in the Service Credentials field, and paste it in the empty credentials field in the Config Editor in Unity.
- Click Apply Credentials.
- Repeat steps 1 - 5 for each service you want to use.
- Click Save, and close the Config Editor.
The SDK contains a TestNLC classifier, which contains classes for temperature and conditions. Before you develop a sample application in the next section, train the classifier on the test data.
- Open the NLC Editor by clicking Watson -> NLC Editor.
- Locate the TestNLC classifier, and click Train. The training process begins. The process lasts a few minutes.
- To check the status of the training process, click Refresh. When the status changes from Training to Available, the process is finished, and you can begin to develop a basic application that uses the Natural Language Classifier, as described in the next section.
You can quickly develop a basic application that uses the Speech to Text service and the Natural Language Classifier service by using the prefabs that come with the SDK. Ensure that you prepare the test data before you complete the the following steps:
- Create a new scene and drag the following prefabs from
Assets -> Watson -> Prefabs
, and drop them in the Hierarchy tab:
- MicWidget
- SpeechToTextWidget
- NlcWidget
- ClassDisplayWidget
- Select the NlcWidget.
- In the Classifier Name field in the Inspector tab, specify
TestNLC/
. - In the NLC Editor, expand the TestNLC classifier, expand the classes, and determine which questions about the weather to ask to test the classifier.
- Run the application.
- Say your questions into the microphone to test the MicWidget, the SpeechToTextWidget, and the NlcWidget.
The SDK contains editors for managing your dialogs and classifiers.
You can upload dialogs by using the Dialog Editor.
- Click Watson -> Dialog Editor. The Dialog Editor window is displayed.
- Specify a name for the dialog in the Name field.
- Click Upload.
- Navigate to the dialog file to be uploaded, and click Open.
You can use the NLC Editor to import and export classifier files, and create new classifiers and edit them.
- Click Watson -> NLC Editor. The NLC Editor window is displayed.
- Click Import.
- Navigate to the
.csv
file to import, and click Open. The file is imported. - Click Train.
- Click Watson -> NLC Editor. The NLC Editor window is displayed.
- In the Name field, specify a name for the classifier.
- Click Create.
- Click Watson -> NLC Editor. The NLC Editor window is displayed.
- Expand the classifier.
- To create a new class, specity a name for the new class in the empty field, and click Add Class.
- To add a phrase to the class, specify a phrase in the empty field, and click Add Phrase.
- Click Train.