Watosonを使ってUnityの中にいるキャラクターと会話させたい
制作したものをrunさせた時に起きました。
発生している問題・エラーメッセージ
Assets/UnityChan/Scripts/WatsonAssistant.cs(58,31): error CS1525: Unexpected symbol `intent'
該当のソースコード
//WatsonAssistant.cs using System.Collections; using System.Collections.Generic; using UnityEngine; using IBM.Watson.DeveloperCloud.Services.Assistant.v1; using IBM.Watson.DeveloperCloud.Connection; using IBM.Watson.DeveloperCloud.Utilities; public class WatsonAssistant : MonoBehaviour { #region PLEASE SET THESE VARIABLES IN THE INSPECTOR [SerializeField] private string _username; [SerializeField] private string _password; [SerializeField] private string _url; [SerializeField] private string _versionDate; [SerializeField] private string _workspaceId; #endregion private Assistant m_Conversation; private string m_Input = "おはよう"; // Use this for initialization void Start() { // Create credential and instantiate service Credentials credentials = new Credentials(_username, _password, _url); m_Conversation = new Assistant(credentials); Debug.Log("User m_Input"); m_Conversation.VersionDate = _versionDate; // Message Dictionary<string, object> input = new Dictionary<string, object>(); input.Add("textInput"); MessageRequest messageRequest = new MessageRequest() { Input = input }; m_Conversation.Message(OnMessage, OnFail, _workspaceId, messageRequest); } void OnMessage(object resp, Dictionary<string, object> customData) { if (resp is Dictionary<string, object>) { Dictionary<string, object> dic_resp = (Dictionary<string, object>)resp; foreach (object o in (List<object>)dic_resp["intents"]) { Dictionary<string, object> dic_intent = (Dictionary<string, object>)o; Debug.Log("intent dic_intent ["intent"] + ",confidence:"+dic_intent["confidence"]"); } Dictionary<string, object> dic_output = (Dictionary<string, object>)dic_resp["output"]; string res = ""; foreach (object o in (List<object>)dic_output["text"]) { res += o.ToString(); } Debug.Log("response res"); } } private void OnFail(RESTConnector.Error error, Dictionary<string, object> customData) { Debug.Log("SampleConversation.OnFailror received: " + error.ToString()); } // Update is called once per frame void Update() { } }
試したこと
インターネットで調べたところ、全角スペースになっているとこのエラーが出ると書かれていたので、半角スペースに直したのですがエラーが解消されませんでした。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。