c#
1public class defineField 2{ 3 public const int WIDTH = 5; 4 public const int HEIGTH = 5; 5} 6 7public class Test : MonoBehaviour 8{ 9 public GameObject Obj; 10 private Vector3 DefaltPosition = new Vector3(0, 0, 0); 11 12 private void Start() 13 { 14 Vector3 Position; 15 for(int y = 0; y < defineField.HEIGTH; y++) 16 { 17 for (int x = 0; x < defineField.WIDTH; x++) 18 { 19 Position = new Vector2(DefaltPosition.x + (float)x, 0); 20 //x軸 表示 21 Instantiate(Obj, Position, Quaternion.identity); 22 } 23 //改行 24 Position = new Vector2(DefaltPosition.x, DefaltPosition.y - (float)y); 25 Instantiate(Obj, Position, Quaternion.identity); 26 27 } 28 } 29} 30
以上のようなコーディングで、オブジェクトの生成を試みたのですが、
このような実行結果になってしまいます。原因をさぐっているのですが、理解が出来ていません。
ヒントをご教授していただけると嬉しいです。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。