前提・実現したいこと
Assets/Scripts/Client.cs(53,36): error CS0029: Cannot implicitly convert type string' to
char' となってしまいました。どうすればいいのでしょうか。
該当のソースコード
c#
1using UnityEngine; 2using System.Linq; 3using System.Collections; 4using System.Collections.Generic; 5using System.Net; 6using System.Net.Sockets; 7using System.Text; 8using System.Threading; 9using UnityEngine.UI; 10using UnityEngine.Networking; 11 12 13[RequireComponent( typeof(MMD4M_LipSync) )] 14public class Client : MonoBehaviour 15{ 16 private MMD4M_LipSync lipSync_; 17 public AudioClip[] audioClips; 18 19 [SerializeField] BubbleController bubbleController; 20 string URL = "http://127.0.0.1:8000/"; 21 22 string[] resultList; 23 24 void Start() 25 { 26 lipSync_ = GetComponent<MMD4M_LipSync>(); 27 } 28 29 public void GetWords (string word) 30 { 31 StartCoroutine (Post (word)); 32 } 33 34 35 private IEnumerator Post (string word) 36 { 37 WWWForm form = new WWWForm (); 38 form.AddField ("word", word); 39 UnityWebRequest request = UnityWebRequest.Post (URL, form); 40 41 // リクエスト送信 42 yield return request.Send (); 43 44 if (request.isNetworkError) { 45 Debug.Log ("Error:" + request.error); 46 } else { 47 if (request.responseCode == 200) { 48 //Python Serverからデータを取得 49 string w = request.downloadHandler.text; 50 Debug.Log (w); 51 Debug.Log ("Success :D"); 52 53 char[] separator = new char[] {" "}; 54 string[] w1 = w.Split(separator); 55 56 List<string> list = new List<string>(); 57 list.AddRange(w1); 58 59 string talk = list[0]; 60 lipSync_.Talk(talk); 61 62 string emo = list[1]; 63 Debug.Log (emo); 64 65 } else { 66 Debug.Log ("Failed ;( :" + request.responseCode); 67 } 68 } 69 } 70 71} 72
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。