前提・実現したいこと
ここに質問の内容を詳しく書いてください。
steamVR,VRsample等のアセットを下記のソースコードと併用すると
大量のエラーを出してきますが、回避方法がわかりません
よろしくおねがいします
発生している問題・エラーメッセージ
エラーメッセージ Assets/steamvr_unity_plugin-1.2.3/Assets/SteamVR/InteractionSystem/Samples/Scripts/ControllerHintsExample.cs(46,20): error CS1503: Argument `#1' cannot convert `Coroutine' expression to type `System.Collections.IEnumerator'
該当のソースコード
ソースコード using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class Coroutine : MonoBehaviour { IEnumerator coroutine; // Use this for initialization public Text txt; public GameObject chiken; void Start () { StartCoroutine(Loop(2f)); this.coroutine = Routine(); txt.text = "あらすじ。 "; } IEnumerator Loop(float second) { while (true) { // secondで指定した秒数ループします yield return new WaitForSeconds(second); Instantiate(chiken, new Vector3(0.0f, 0.5f, -3.0f), Quaternion.AngleAxis(180, Vector3.up)); } } // Update is called once per frame void Update () { } public void Shoot() { bool hasNext = this.coroutine.MoveNext(); if (!hasNext) { // this.coroutine.Reset(); // NotSupportedExceptionが出る //this.coroutine = Routine(); SceneManager.LoadScene("Scene1a"); } else { print("current : " + this.coroutine.Current); } } IEnumerator Routine() { txt.text= "にわとりが侵略してきます。 "; yield return 1; txt.text = "にわとりはどんどんやってきます。"; yield return 2; txt.text = "退治しましょう。"; yield return 3; } }
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー