Skip to content

Instantly share code, notes, and snippets.

@akeller
akeller / WatsonConversation.cs
Last active December 1, 2017 22:42
Watson Unity SDK Getting Started - Conversation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using IBM.Watson.DeveloperCloud.Services.Conversation.v1;
using IBM.Watson.DeveloperCloud.DataTypes;
using IBM.Watson.DeveloperCloud.Utilities;
using IBM.Watson.DeveloperCloud.Logging;
using IBM.Watson.DeveloperCloud.Connection;
using FullSerializer;
@akeller
akeller / WatsonToneAnalyzer.cs
Last active December 1, 2017 23:07
Watson Unity SDK Getting Started - Tone Analyzer
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using IBM.Watson.DeveloperCloud.Services.ToneAnalyzer.v3;
using IBM.Watson.DeveloperCloud.Utilities;
using IBM.Watson.DeveloperCloud.DataTypes;
using IBM.Watson.DeveloperCloud.Logging;
using IBM.Watson.DeveloperCloud.Connection;
using FullSerializer;
@akeller
akeller / WatsonTextToSpeech.cs
Last active April 13, 2019 16:39
Watson Unity SDK Getting Started - Text to Speech
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using IBM.Watson.DeveloperCloud.Services.TextToSpeech.v1;
using IBM.Watson.DeveloperCloud.DataTypes;
using IBM.Watson.DeveloperCloud.Utilities;
using IBM.Watson.DeveloperCloud.Logging;
using IBM.Watson.DeveloperCloud.Connection;
using System.IO;
using FullSerializer;
@akeller
akeller / WatsonSpeechToText.cs
Last active May 23, 2018 20:24
Watson Unity SDK Getting Started - Speech to Text
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using IBM.Watson.DeveloperCloud.Services.SpeechToText.v1;
using IBM.Watson.DeveloperCloud.Widgets;
using IBM.Watson.DeveloperCloud.DataTypes;
using IBM.Watson.DeveloperCloud.Utilities;
using IBM.Watson.DeveloperCloud.Logging;
using IBM.Watson.DeveloperCloud.Connection;
using System.IO;
@akeller
akeller / WatsonAssistantInitiation.cs
Created May 15, 2018 14:32
Initiation Watson Assistant with the Watson Unity SDK
//*******************************************
//You may have initiated Watson Conversation with the Watson Unity SDK previously like this, within the start function with a string.
//*******************************************
void Start()
{
//enter username and password as a string
Credentials credentials = new Credentials(<username>, <password>, "https://gateway.watsonplatform.net/conversation/api");
Conversation _conversation = new Conversation(credentials);
@akeller
akeller / WatsonSTTModelMakerUnity.cs
Last active October 12, 2018 12:37
Watson Speech-to-Text create custom language model when Watson just doesn't hear you right. Designed specifically for Unity when using STT, TTS, and Assistant (STT and TTS have some naming conflicts)
//I recommend running this only once so you only create one customizationID.
//It takes some time for each step to get to a ready state, so I recommend doing this outside of your game if possible and just referencing the customizationID after training.
//Be sure to use your customizationID when calling Active (SDK example) when you set your other STT params.
private IEnumerator CreateGameBoardModel(){
Debug.Log("Inside CreateGameBoardModel");
//Create customization
_speechToText.CreateCustomization(HandleCreateCustomization, OnFail, "unity-game-board", "en-US_BroadbandModel", "Adding game board domain items");
while (!_createCustomizationsAdded)
@akeller
akeller / WatsonLogic.cs
Created July 26, 2018 15:07
Updated Assistant + STT + TTS
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using IBM.Watson.DeveloperCloud.Services.Assistant.v1;
using IBM.Watson.DeveloperCloud.Services.SpeechToText.v1;
using IBM.Watson.DeveloperCloud.Services.TextToSpeech.v1;
using IBM.Watson.DeveloperCloud.Utilities;
using IBM.Watson.DeveloperCloud.Logging;
using System;
using IBM.Watson.DeveloperCloud.Connection;
@akeller
akeller / TakePicture.cs
Created August 1, 2018 15:04
Unity + MAX (Model Asset Exchange) Image Caption Generator
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
using System.IO;
using System;
public class TakePicture : MonoBehaviour {
@akeller
akeller / TakePictureRedux.cs
Last active November 2, 2019 06:52
Unity + MAX (Model Asset Exchange) now with 100% more JSON parsing!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
using System.IO;
using System;
public class TakePicture : MonoBehaviour {
@akeller
akeller / WatsonAssistantApiKey.cs
Created December 12, 2018 23:16
A snippet for using Watson Assistant with API key authentication
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using IBM.Watson.DeveloperCloud.Services.Assistant.v1;
using IBM.Watson.DeveloperCloud.Utilities;
using IBM.Watson.DeveloperCloud.Logging;
using IBM.Watson.DeveloperCloud.Connection;
using FullSerializer;
using IBM.Watson.DeveloperCloud.DataTypes;