###前提・実現したいこと
CubeをつかってX,Y軸にブロックならべてピラミッド状の形にしたいです。
for文を使いX,Y軸に10個ずつ並べるというところはできるのですが、上に行くにつれてブロックの数を少なくしていくというところができません。
できれば、unity内で数値を変更してブロック数を増減できるようにしたいです。
回答よろしくお願いします。
###該当のソースコード
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Copy : MonoBehaviour { public GameObject Prefab; // Use this for initialization void Start () { for (int x = 0; x < 10; x++){ for (int y = 0; y < 10; y++){ Instantiate(Prefab, new Vector3(x * 1.0f, y * 1.0f,0), Quaternion.identity); } } } // Update is called once per frame void Update () { } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/07/10 14:46