WARNING: This repository is no longer maintained :warning: This repository will not be updated. The repository will be kept available in read-only mode.
This repository will not be updated. The repository will be kept available in read-only mode.
Read this in other languages: 한국어, 中国.
In this Code Pattern we will create a Virtual Reality game based on Watson's Speech-to-Text and Watson's Assistant services.
In Virtual Reality, where you truly "inhabit" the space, speech can feel like a more natural interface than other methods. Providing speech controls allows developers to create more immersive experiences. Google Cardboard is by far the most popular VR headset platform, with 84 million sold in 2016 (http://www.hypergridbusiness.com/2016/11/report-98-of-vr-headsets-sold-this-year-are-for-mobile-phones).
When the reader has completed this Code Pattern, they will understand how to:
On your local machine:
git clone https://github.com/IBM/vr-speech-sandbox-cardboard.git
cd vr-speech-sandbox-cardboard
In IBM Cloud:
Launch tool
.Skills
tab.Create new
Import skill
tab.Choose JSON file
, go to your cloned repo dir, and Open
the workspace.json file in data/workspace.json
.Everything
and click Import
.Assistant
tab.Create assistant
.Speech Sandbox Assistant
.Add dialog Skill
Add existing skill
Choose the IBM Speech Sandbox Cardboard
Skill.Settings
.API Details
and copy the Assistant ID
for later configuration in the Unity app.Note: This has been compiled and tested using Unity
2018.3.0f2
and Unity2019.1.0f2
and Watson Unity SDK versionv3.1.0
.
Note: If you are in any IBM Cloud region other than US-South you must use Unity 2018.2 or higher. This is because Unity 2018.2 or higher is needed for TLS 1.2, which is the only TLS version available in all regions other than US-South.
SpeechSandbox/Assets
directory:cd SpeechSandbox/Assets
git clone https://github.com/watson-developer-cloud/unity-sdk.git
git checkout v3.1.0
SpeechSandbox
directory.Assets
-> Scenes
-> Playground
and double-click to load the scene.Player
and then the Streaming Speech
object.Speech To Text
and Watson Assistant
Speech To Text IAM APIKey
and the Assistant IAM APIKey
Speech To Text Service Url
and the Assistant Service Url
, or except the defaults. Also fill out the Assistant Id
, and the Assistant Version Date
. There are tool tips which will show help and any defaults.Press Play
To Build an android .apk file and deploy to your phone, you can File -> Build Settings (Ctrl + Shift +B) and click Build.
When prompted you can name your build and then move it to your phone.
Alternately, connect the phone via USB and File-> Build and Run (or Ctrl+B).
Make sure you have enabled USB Debugging:
Open Settings-> About-> Software Information-> More
Then tap “Build number” seven times to enable Developer options.
Go back to Settings menu and now you'll be able to see “Developer options” there.
Tap it and turn on USB Debugging from the menu on the next screen.
Once the app is deployed to your phone it will start, but you'll need to set permissions for the app before it will work correctly:
Assets/Scripts/CreatableObject.cs(162,43): error CS0117: `GvrController' does not contain a definition for `Gyro'
This is because you have your Build Settings
-> Platform
set to PC, Mac, or Linux Standalone
. Solve this problem by changing the Build Settings
-> Platform
to Android
and clicking Switch Platform
.
Assets/unity-sdk/Scripts/Utilities/Credentials.cs(399,51): error CS1061: Type `System.DateTimeOffset' does not contain a definition for `ToUnixTimeSeconds' and no extension method `ToUnixTimeSeconds' of type `System.DateTimeOffset' could be found. Are you missing an assembly reference?
The solution is to go to Build Settings
->Player Settings
->
Other Settings
->Scripting Runtime Version
and change to:
Experimental(.NET 4.6 Equivalent)
.
This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.