using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BrickWarGame : MonoBehaviour
{
private int columnNum = 10;//列数
private int rowNum = 10;//列数
public GameObject brick;//预制体,此处是一个立方体
// Use this for initialization
void Start()
{
for (int rowIndex = 0; rowIndex < rowNum; rowIndex++)
{
for (int columnIndex = 0; columnIndex < 10; columnIndex++)
{
//在新的位置创建一个brick的实例
Instantiate(brick, new Vector3(columnIndex - 5f, 0.5f + rowIndex, 0), Quaternion.identity);
}
}
}
}
unity 创建预制体的实例
最新推荐文章于 2024-07-28 12:34:42 发布