前提・実現したいこと
https://gentom.tech/unity-word2vec-client/やhttp://tips.hecomi.com/entry/20131208/1386514048やhttp://tips.hecomi.com/entry/2014/07/21/125319を参考にして喋らせようとしていたところ以下のようなエラーが出たのですがどうすればいいのでしょうか
50行目は lipSync_.Talk(w); のところです
発生している問題・エラーメッセージ
NullReferenceException: Object reference not set to an instance of an object Client+<Post>c__Iterator0.MoveNext () (at Assets/Scripts/Client.cs:50)
該当のソースコード
c#
1using UnityEngine; 2using System.Collections; 3using System.Collections.Generic; 4using System.Net; 5using System.Net.Sockets; 6using System.Text; 7using System.Threading; 8using UnityEngine.UI; 9using UnityEngine.Networking; 10 11[RequireComponent( typeof(UnityChanLipSync) )] 12public class Client : MonoBehaviour 13{ 14 private UnityChanLipSync lipSync_; 15 public AudioClip[] audioClips; 16 17 [SerializeField] BubbleController bubbleController; 18 string URL = "http://127.0.0.1:8000/"; 19 20 string[] resultList; 21 22 void Start() 23 { 24 lipSync_ = GetComponent<UnityChanLipSync>(); 25 } 26 27 public void GetWords (string word) 28 { 29 StartCoroutine (Post (word)); 30 } 31 32 33 private IEnumerator Post (string word) 34 { 35 WWWForm form = new WWWForm (); 36 form.AddField ("word", word); 37 UnityWebRequest request = UnityWebRequest.Post (URL, form); 38 39 // リクエスト送信 40 yield return request.Send (); 41 42 if (request.isNetworkError) { 43 Debug.Log ("Error:" + request.error); 44 } else { 45 if (request.responseCode == 200) { 46 // Get Data from Python Server 47 string w = request.downloadHandler.text; 48 Debug.Log (w); 49 50 lipSync_.Talk(w); 51 Debug.Log ("Success :D"); 52 } else { 53 Debug.Log ("Failed ;( :" + request.responseCode); 54 } 55 } 56 } 57 58} 59
補足情報(FW/ツールのバージョンなど)
ほかになにか情報が必要な場合は教えてください。追加したいと思います。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。