# 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.
This pattern was originally published using ARKit and only available on iOS. With Unity introducing AR Foundation, this pattern can now run on either ARKit or ARCore depending on what device you build for.
In this Code Pattern we will use Assistant, Speech-to-Text, and Text-to-Speech deployed to an iPhone or an Android phone, using either ARKit or ARCore respectively, to have a voice-powered animated avatar in Unity.
Augmented reality allows a lower barrier to entry for both developers and end-users thanks to framework compatibility in phones and digital eyewear. Unity's AR Foundation continues to lower the barrier for developers, allowing a single source code for a Unity project to take advantage of ARKit and ARCore.
For more information about AR Foundation, take a look at Unity's blog.
When the reader has completed this Code Pattern, they will understand how to:
On your local machine:
git clone https://github.com/IBM/Watson-Unity-ARKit.git
cd Watson-Unity-ARKit
In IBM Cloud:
Launch Tool
.
Create a Skill
.
Create skill
button.
voiceActivatedMotionSimple.json
file located in your clone of this repository.Assistants
.Create Assistant
.Create assistant
.Add dialog skill
to add the skill you just imported to this Assistant....
menu in the top and click "Settings" to see the Assistant Settings.
API Details
and find your Assistant Id. You will need this in the next section.Note: This has been compiled and tested using Unity 2018.3.0f2 and Watson SDK for Unity 3.1.0 (2019-04-09) & Unity Core SDK 0.2.0 (2019-04-09).
Note: If you are in any IBM Cloud region other than US-South/Dallas 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.
The directories for unity-sdk and unity-sdk-core are blank within the Assets directory, placeholders for where the SDKs should be. Either delete these blank directories or move the contents of the SDKs into the directories after the following commands.
git clone https://github.com/watson-developer-cloud/unity-sdk.git
Make sure you are on the 3.1.0 tagged branch.
git clone https://github.com/IBM/unity-sdk-core.git
Make sure you are on the 0.2.0 tagged branch.
Please note, the following instructions include scene changes and game objects have been added or replaced for AR Foundation.
AR Default Plane
, click DefaultAvatar
. If you are not in the Main scene, click Scenes
and Main
in your Project window, then find the game objects listed above.Speech To Text
, Text to Speech
, and Assistant
. If you are using US-South or Dallas, you can leave the Assistant URL
, Speech to Text URL
, and Text To Speech URL
blank, taking on the default value as shown in the WatsonLogic.cs file. If not, please provide the URL values listed on the Manage page for each service in IBM Cloud.Assistant Id
, Assistant IAM Apikey
, Speech to Text Iam Apikey
, Text to Speech Iam Apikey
. All Iam Apikey values are your API key or token, listed under the URL on the Manage page for each service.Build steps for iOS have been tested with iOS 11+ and Xcode 10.2.1.
Unity-iPhone.xcodeproj
.Build steps for Android have been tested with Pie on a Pixel 2 device with Android Studio 3.4.1.
AR features are only available on iOS 11+ and can not run on an emulator/simulator. Be sure to check your player settings to target minimum iOS device of 11, and your Xcode deployment target (under deployment info) to be 11 also.
In order to run the app you will need to sign it. Follow steps here.
Mojave updates may adjust security settings and block microphone access in Unity. If Watson Speech to Text appears to be in a ready and listening state but not hearing audio, make sure to check your security settings for microphone permissions. For more information: https://support.apple.com/en-us/HT209175.
You may need the ARCore APK for your Android emulator. This pattern has been tested with ARCore SDK v1.9.0 on a Pixel 2 device running Pie.
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.