前提・実現したいこと
void Update内のVector3 posのデータをIEnumerator Start内で実行したいのですがどうすればいいのか分かりません。
該当のソースコード
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class AType : MonoBehaviour 6{ 7 public GameObject bullet; 8 9 void Update() 10 { 11 Vector3 pos = this.gameObject.transform.position; 12 } 13 14 IEnumerator Start() 15 { 16 while (true) 17 { 18 Instantiate(bullet, new Vector3(pos.x, pos.y + 0.5f, pos.z), transform.rotation); 19 yield return new WaitForSeconds(0.05f); 20 } 21 } 22}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/02 01:18