前提・実現したいこと
Unity(C#)でFlappybirdを作っています
土管を無限生成し、高さをランダムにするプログラムを書いているのですが、生成されるy座標がランダムに変わりません。
該当のソースコード
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using Random = UnityEngine.Random; 5 6public class Mov : MonoBehaviour 7{ 8 public Vector3 pos_; 9 private void Start() 10 { 11 Invoke("Local", 1); 12 } 13 // Start is called before the first frame update 14 private void Update() 15 { 16 pos_ = new Vector3(20f,Random.Range(-2,3), 0); 17 } 18 void Local () 19 { 20 GameObject obj = (GameObject)Resources.Load("piepes"); 21 22 Instantiate(obj, pos_, Quaternion.identity); 23 } 24} 25
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。